Code:
#include <stdio.h>
int main()
{
int a, b;
printf("enter a number: ");
scanf("%d", &a);
printf("enter another number: ");
scanf("%d", &b);
if (a>b);
printf("%d is greater than %d\n", a,b);
else
printf("%d is less than %d\n", a,b);
return 0;
}
my gcc keeps saying:
file.c: In function main:
file.c:21: error: expected expression before else
I tried using {} before and after each print/scan command.
I tried using:
Code:
else if (a<b); //instead of just "else"
And I tried it with and without the ; after if and else in every combination. I just need a little direction. Thanks!