Sure, something like that would work. e.g.
Code:
int timesthree(int x) {
return x * 3;
}
x = 3;
while(x <= 12) {
printf("%i\n", x);
x = timesthree(x);
}
However, I think you are perhaps over-complicating things. I quote:
There are tasks such as "print all multiples of a number" or "change the value of a variable".
If all you want to do is print all multiples of a number, you could use a function like
Code:
void print_multiples(int number, int min, int max);
and do everything in there. (Set x to min, increment by number until x is max, print the number each time.) Changing the value of a variable between different functions isn't necessary in this case. (Passing variables is -- unless you want the function to always print multiples of 3 between 3 and 12 -- but return values isn't really.)
But of course, when you get around to implementing the "change the value of a variable", you probably will be using return values and stuff.