Write a c program to enter roll number and marks of three subjects and print total maks,percentage,result and grade.
#include<stdio.h>
#include<conio.h>
void main()
{
int rollno;
float s1,s1,s3,total,per;
clrscr();
printf("Enter Roll Number:");
scanf("%d",&rollno);
printf("Enter marks of subject s1,s2,s3:");
scanf("%f %f %f",&s1 ,&s2 ,&s3);
total=s1+s2+s3;
per=total/3;
printf("Percentage:%.2f",per); //%.2f will take two digit after decimal.
if(s1>=35&&s2>=35&&s3>=35)
{
printf("The student is Pass");
}
else
{
printf("The student is Fail");
}
if(per>=70)
{
printf("Grade:Distiction");
}
else if(per>=60||per<70)
{
printf("Grade:First Class");
}
else if(per>=50||per<60)
{
printf("Grade:Second Class");
}
else if(per<50)
{
printf("Grade:Pass Class");
}
getch();
}
Comments
Post a Comment