Write a program to print the grades to a student.
//program to print the grades to a student.
//marks < 35 is C
//35 <= marks < 70 is B
//70 <= marks < 90 is A
//90 <= marks <=100 is A+
#include<stdio.h>
#include<math.h>
int main()
{
int marks;
printf("enter marks(0-100)\n");
scanf("%d", &marks);
if(marks <35 ){
printf("grade C\n");
}
else if(marks >= 35 && marks < 70){
printf("grade B\n");
}
else if(marks >=70 && marks < 90){
printf("grade A\n");
}
else if(marks >=90 && marks <= 100){
printf("grade A+\n");
}
else{
printf("invalid marks");
}
return 0;
}
Output :
enter marks(0-100)
27
grade C
--------------------------------
Process exited after 9.762 seconds with return value 0
Press any key to continue . . .
enter marks(0-100)
68
grade B
--------------------------------
Process exited after 5.493 seconds with return value 0
Press any key to continue . . .
enter marks(0-100)
79
grade A
--------------------------------
Process exited after 5.493 seconds with return value 0
Press any key to continue . . .
enter marks(0-100)
95
grade A+
--------------------------------
Process exited after 5.493 seconds with return value 0
Press any key to continue . . .
Comments
Post a Comment
Please do not enter any spam link in the comment box.