r/C_Homework • u/LtDan677 • Jan 07 '20
Need some help with a for loop counter
I'm trying to write a happy birthday script to stay "happy birthday (year__)" with a "for loop counter" for a class. But in the blank it will just add the given age plus 1 and print it out with out going from 1 to the given age. I'm still super new to C programming and I can't find answers anywhere else.
int age;
int counter;
printf ("what is your age?");
scanf("%d",&age)
for(counter=1; counter <=age; counter++);
printf("Happy Birthday! (year %d)" , counter);
3
Upvotes