Saturday, 1 March 2014

C Program to find student grading


To find Student grading.

Description:

Find the grade of a student by reading marks.


Algorithm

Step 1 : start
Step 2 : read marks
Step 3 : if marks >= 80 then grade =A  go to step 7
Ste p 4 : if marks >= 60 and marks <=80 then grade = B go to step 7
Step 5  : if marks >=40 and marks <=60 then grade = C go to step 7
Step 6 : display failed
Step 7 : display grade.
Step 8 : stop




Program


#include <stdio.h>
int main(void){
int num;
printf("Enter your mark ");
scanf("%d",&num);
printf(" You entered %d", num); // printing outputs

if(num >= 80){
printf(" You got A grade"); // printing outputs
}
else if ( num >=60){ // Note the space between else & if
printf(" You got B grade");
}
else if ( num >=40){
printf(" You got C grade");
}

else if ( num < 40){
printf(" You Failed in this exam");
}
return 0;
}

No comments: