Aim:
To write a ‘C’ program to read the mark of the student and display grade based on the following norms:
>=75 Grade A , >=50 and <75 Grade B , >=25 and <50 Grade C
<25 Grade F
Algorithm:
- Read the average mark of the student.
- If the mark is >=75 print “GRADE A”.
- If the mark is between 50 to 75 print “GRADE B”.
- If the mark is between 25 to 50 print “GRADE C”.
- If the mark is less than 25 print “GRADE F”.
- Stop.
Program:
/* To display the grade of the student */
#include<stdio.h>
#include<conio.h>
void main()
{
float avg;
clrscr();
printf("Enter the average mark of the student:");
scanf("%f",&avg);
if(avg>=75)
printf("\n\tThe student's grade - A");
else if(avg>=50)
printf("\n\tThe student's grade - B");
else if(avg>=25)
printf("\n\tThe student's grade - C");
else
printf("\n\tThe student's grade -F");
getch();
}
Output 1:
Enter the average mark of the student:78
The student's grade - A
Output 2:
Enter the average mark of the student:50
The student's grade – B
Output 3:
Enter the average mark of the student:30
The student's grade - C
Output 4:
Enter the average mark of the student:24
The student's grade -F
No comments:
Post a Comment