I can't seem to locate the problem in my program where it says, "error: expected declaration or statement at the end of input"
I would like to learn more about this mistake
#include<stdio.h>
int main()
{
float Math, English, Science, Fundamentals, per;
printf("Enter GPA of 4 subject\n");
scanf("%f %f %f %f", &Math, &English, &Science, &Fundamentals);
per = (Math + English + Science + Fundamentals) / 4.0;
if(per >= 5)
{
printf("Your GWA is: 75\n");
}
else
{
if(per >= 3)
{
printf("Your GWA is: 75\n");
}
else
{
if(per >= 2)
{
printf("Your GWA is: 85\n");
}
else
{
if(per >= 1)
{
printf("Your GWA is: 100\n");
}
}
}
return 0;
}
According to what can be seen in the picture, you wrote return 0
inside the else
section, while you should write the end of the main
function.
Edit:
First line you have to add
#include <iostream>
And also before return 0
you need }
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.