KodeGod.com

023. Write a program to accept roll number ,and marks for three subjects, print total marks and average, also print grade by considering following conditions

Avg>=60 Grade A
Avg<60,Avg >=50 Grade B
Avg<50,Avg >=40 Grade C

Grade F.

#include<stdio.h>
#include<conio.h>  
main()
{
 int RollNumber,m1,m2,m3,total;
 float avg;
 clrscr();
 printf("Enter Roll Number : ");
 scanf("%d",&RollNumber);
 printf("Enter marks for three subjects : ");
 scanf("%d%d%d",&m1,&m2,&m3);
 total=m1+m2+m3;
 avg=total/3.0;
 printf("\nTotal is....... %d",total);
 printf("\nAverage is..... %5.2f %",avg);
 if(avg>=60)
	printf("\nGrade : A");
else if((avg>=50)&&(avg<60))
	printf("\nGrade : B");
 else if((avg>=40)&&(avg<50))
	printf("\nGrade : C");
 else
	printf("\nGrade : F");
 getch();
}