Use the following information for division
Percentage | Grade |
80-100 | First |
70-80 | Second |
50-70 | Third |
0-50 | Fail |
C Program
#include <stdio.h>
#include <stdlib.h>
int main()
{
float sub1,sub2,sub3,avg;
printf("Enter your marks in subject-1:");
scanf("%f",&sub1);
printf("Enter your marks in subject-2:");
scanf("%f",&sub2);
printf("Enter your marks in subject-3:");
scanf("%f",&sub3);
avg=(sub1+sub2+sub3)/3;
if(avg<=100 && avg>=80)
printf("First division");
else if(avg<80 && avg>=70)
printf("Second division");
else if(avg<70 && avg>=50)
printf("Third division");
else if(avg<50 && avg>0)
printf("fail");
else
printf("Please enter marks correctly");
}
0 Comments:
Post a Comment