Eric Florenzanos Programming Meme - Octave/Matlab Solution

28. December 2008

Eric Florenzano started a nice competition.

The rules are:

  1. Implement a program that takes in a user's name and their age, and prints hello to them once for every year that they have been alive.
  2. Post these rules, the source code for your solution, and the following list (with you included) on your blog.
  3. Bonus points if you implement it in a language not yet seen on the following list!

Code for matlab/octave:

name = input('Please enter your name: ', 's');
age = input('Please enter your age: ');
for i = 1:age
  fprintf('%2d) Hello, %s\n', i, name)
endfor

run in octave with

octave meme.m

Tags: matlab, meme, octave

Categories: Matlab

 
 

Write new Comment

captcha