Amphituber
King Bowser
So I'm trying to learn C and I got this little program out of a book.
#include <stdio.h>
main()
{
int iResponse = 0
printf("\nEnter a number from 1 to 10:\n");
scanf("%d", &iResponse);
if ( iResponse < 1 || iResponse > 10 );
printf("\nNope.\n");
else
printf("\nYour number is %d. \n", iResponse);
}
But every time I try to compile it, I get this:
ez.c: In function main:
ez.c:12: error: expected expression before else
Little help? I can't figure out what the problem is, I'm new to programming.
#include <stdio.h>
main()
{
int iResponse = 0
printf("\nEnter a number from 1 to 10:\n");
scanf("%d", &iResponse);
if ( iResponse < 1 || iResponse > 10 );
printf("\nNope.\n");
else
printf("\nYour number is %d. \n", iResponse);
}
But every time I try to compile it, I get this:
ez.c: In function main:
ez.c:12: error: expected expression before else
Little help? I can't figure out what the problem is, I'm new to programming.