Ok, now my code isn't working. It complies but it only does the first line in the for loop. heres the code
Code: Select all
#include <stdio.h>
int count;
int i;
char answer;
int main()
{
printf("File: prac2ex2.c\n");
printf("Aurthor: \n");
printf("Student id: \n");
printf("Email id: \n");
printf("******************************************\n");
printf("This is my own work as defined by the\n");
printf("University's Academic Misconduct Policy.\n");
printf("\n");
count = 100;
printf("Would you like to sing a song?");
scanf("%d",&answer);
printf("\n");
if (answer = 'y')
{
printf("How many verses of the song do you wish to sing?");
scanf("%d", &i);
printf("\n");
i = 100 - i;
while(i < count)
{
printf("%d bottles of beer on the wall\n", i);
printf("%d bottles of beer\n", i);
printf("If one of those bottles should happen to fall\n");
i--;
printf("%d bottles of beer on the wall\n", i);
printf("\n");
}
}
else
printf("");
return 0;
} // end main