Grade
This commit is contained in:
56
Grade.c
Normal file
56
Grade.c
Normal file
@@ -0,0 +1,56 @@
|
||||
// Use else if ladder statements to find out the result grade from the percentage.
|
||||
/* AA 100-90
|
||||
AB 89-75
|
||||
BB 74-60
|
||||
CC 59-35
|
||||
FF <=34
|
||||
*/
|
||||
|
||||
void main() {
|
||||
int s1,s2,s3,s4,s5,t,p;
|
||||
|
||||
printf("\n Enter marks of 5 subjects each out of 100 ");
|
||||
printf("\n\n ********************************************");
|
||||
|
||||
printf("\n\n Maths = ");
|
||||
scanf("%d",&s1);
|
||||
|
||||
printf("\n Science = ");
|
||||
scanf("%d",&s2);
|
||||
|
||||
printf("\n English = ");
|
||||
scanf("%d",&s3);
|
||||
|
||||
printf("\n History = ");
|
||||
scanf("%d",&s4);
|
||||
|
||||
printf("\n Geography = ");
|
||||
scanf("%d",&s5);
|
||||
printf("\n ********************************************");
|
||||
|
||||
t=s1+s2+s3+s4+s5;
|
||||
printf("\n Total marks = %d/500",t);
|
||||
|
||||
p=t/5;
|
||||
printf("\n\n Percentage = %d ",p);
|
||||
printf("\n ********************************************");
|
||||
|
||||
if(p>=90) {
|
||||
printf("\n\n Your Grade : AA");
|
||||
}
|
||||
else if(p>=75) {
|
||||
printf("\n\n Your Grade : AB");
|
||||
}
|
||||
|
||||
else if(p>=60) {
|
||||
printf("\n\n Your Grade : BB");
|
||||
}
|
||||
|
||||
else if(p>=34) {
|
||||
printf("\n\n Your Grade : CC");
|
||||
}
|
||||
|
||||
else {
|
||||
printf("\n\n Your Grade : FF");
|
||||
}
|
||||
}
|
||||
@@ -16,4 +16,5 @@
|
||||
|14 | AgeCheck.c | AgeCheck.exe | WAP to check your age > 18 or not (using if else statement) |
|
||||
|15 | MaximumNo2.c | MaximumNo2.exe | WAP to find out maximum out of two numbers |
|
||||
|16 | MaximumNo4.c | MaximumNo4.exe | WAP to find out maximum out of three numbers using nested if..else |
|
||||
|17 | PositiveOrNegative.c | PositiveOrNegative.exe | WAP to find out a given number is positive, negative or 0 |
|
||||
|17 | PositiveOrNegative.c | PositiveOrNegative.exe | WAP to find out a given number is positive, negative or 0 |
|
||||
|18 | Grade.c | Grade.exe | Use else if ladder statements to find out the result grade from the percentage (Mentioned in file of the program). |
|
||||
Reference in New Issue
Block a user