04-20-2015, 08:21 AM
(This post was last modified: 04-20-2015, 01:10 PM by GISED_Link.)
(04-18-2015, 07:59 AM)Tommyand Wrote:Code:#include <stdio.h>
void FizzBuzz(int x); //Header of the function
int main(void) {
int x; //cannot declare a variable in the condition of the loop (valid in C++, java but not i C(95 ?)
for (x=1; x<=10 ;x++){
FizzBuzz(x);
}
return 0;
}
void FizzBuzz(int x) { //the function
if (x % 3 == 0){ // Or (!(x % 3))
printf("%d : Fizz\n", x);
}
if (x % 5 == 0){ // Or (!(x % 5))
printf("%d : Buzz\n", x);
}
}
I correct it... It miss a lot of {} (after the if and the for), I show x when fizz or buzz is found and add the stdio library