Click here to Skip to main content
15,881,687 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
C
#include<stdio.h>
int main()
{
	float FSc, NTS;
	printf("Enter FSc marks:"); 
	scanf("%f",&FSc);
	printf("Enter NTS marks:");
	scanf("%f",&NTS);
}

if(FSc>70)
{ 
if(NTS>=70)
{
	printf("Congrats, you have been accepted in IT Department, Oxford University!");
}
else(NTS>=60)
{
	printf("Congrats, you have been accepted in Electronics Department, Oxford University!");
}
}


What I have tried:

I am new to coding so i dont know how to solve. I have tried putting column before the if and putting curly bracket too, but it did not work
Posted
Updated 28-Nov-22 16:05pm
v2

1 solution

int main()
{
....
}
the compiler sees a pair of {},
then it think the main function is ended.
So, the 'if sentence' below it is not inside any function, that's a syntax error.
 
Share this answer
 
Comments
AR Logs 28-Nov-22 23:59pm    
So i should add these {} or remove? i am not able to understand.
longjmp 29-Nov-22 3:53am    
move the if {...} sentence into main {} like this: #include<stdio.h> int main() { float FSc, NTS; printf("Enter FSc marks:"); scanf("%f",&FSc); printf("Enter NTS marks:"); scanf("%f",&NTS); if(FSc>70) { if(NTS>=70) { printf("Congrats, you have been accepted in IT Department, Oxford University!"); } else(NTS>=60) { printf("Congrats, you have been accepted in Electronics Department, Oxford University!"); } } return 0; // add a return sentence }

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900