-
HELP!! Syntax errors
I am trying to compile a simple program and I know there are a bunch of syntax errors.
The program is designed to output to the used which of the first four prime numbers the number they input is divisible by. Here is the code:
Code:
#include(stdio.h>
int main(){
int num;
printf("Please enter your number:);
scanf("%d",num);
printf("\n\nOf the first prime numbers, your number is divisible by:");
If (num%2==0)
printf("2")
If (num%3==0)
printf("3")
If (num%5==0)
printf("5")
If (num%7==0)
printf("7")
}
I get errors about args and pointers. I'm new to this and I don't really know what it means. Can someone help?
-
In C all keywords are lower-case, so replace "If" with "if". You are also massively low on semicolons. Add one after each of the printf("<number>")
--
Mats
-
Oh, and you want to do scanf("%d", &num)
--
Mats