HELP NEEDED :D
So trying to embark on making a time's tables quiz for my brother.Very new to coding so trying to do it as simple as possible but really stuck. Any help would be awesome Basically I keep getting this error
[ In function 'main': Line 17: error: expected expression before 'else']
#include <stdio.h>
int main (){
int answers_eight[] = {8,16,24,32,40,48,56,64,72,80,88,96};
int answer ;
printf ("8x1 = : ");
scanf ("%d",&answer);
If (answer == '8');
{
printf ("Correct");
}
else
{
printf ("Incorrect");
}
return 0;
}
Your code has various syntax errors (
If
instead ofif
, semicolon after if-condition). Additionally, your code has a logical problem where you read an int and then compare against a string. This version works and is properly indented: