little prob
every thing is working fine but below on if else statements. when i compile it shows error that "else" is miss placed tell me what mistake i did??
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
|
#include<stdio.h>
#include<conio.h>
int main()
{
textcolor(RED);
textbackground(WHITE);
clrscr(); {
printf("Here You Can Check Results \n kindly write marks bellow \n"); }
int math,phy,chem,total; float re;
{
printf("\n Maths Marks:"); scanf("%d", &math);
}{
printf("\n Physics Marks: "); scanf("%d", &phy);
} {
printf("\n Chemistry Marks:"); scanf("%d", &chem);
}{
printf("\n Total:"); }
{ printf("%d",total= math+phy+chem); }
{
printf("\n Percentage:"); } re=(total*100)/400;
{printf("%f",re); } { printf("%"); }
if(re>90)
{printf("A-1 Grade");
else if(re>70 && re<90)
{printf("A Grade"); }
else if(re>50 && re<70)
{ printf("B Grade"); }
else if(re>33 && re<50)
{ printf("Pass"); }
else {
printf("Fail"); }
|
Line 23: You have a { with no closing } Your else clause is following printf. Not valid.
Why so many {} in your program? You don't need to put {} around every statement.
Last edited on
Topic archived. No new replies allowed.