# C program to calculate the Grade of Student using Percentage | Grading program in C

### Description:

Find the grade of a student by reading marks or by taking Percentage. Here we are assuming greater than 80 percentage or marks as grade A, if the Marks are between 80-60 Grade is B, if the marks are between 60-40 grade is C, If student got marks below 40 it means he is Failed.

### Algorithm :

Step 1 : start
Step 2 : read marks or Percentage
Step 3 : if marks >= 80 then grade =A, go to step 7
Step 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 8 : stop.

### Related Programs : Venkat

Hi Guys, I am Venkatesh. I am a programmer and an Open Source enthusiast. I write about programming and technology on this blog.

### 7 Responses

1. Mary Rose says:

Hi all, can you help me with this? “Create an algorithm and program that will ask the name of the student then, calculate the final grade of the student by getting the average of four quarter grades.”

2. Devansh Upadhyay says:

Draw a flowchart to print ‘A’ grade if marks is greater than 50 else print ‘B’ marks is greater than 30 otherwise fail

3. Maryam malik says:

Find the %mark secured by a student given all marks write it algorithm

4. sidvaldez says:

hey guys can u help me in this problem

5. Vimalan says:

Hey I need a favour. How do I do an algorithm, pseudocode and flowchart fo the attached program?

#include
#include // The Rounding Of Application //
#include // To Copy The Score and Grade for sorting Purposes //

main()
{
char MATRICS, temp4, temp5;
int i, M, N, O, P, count;
float MANUAL, CAD, TEST1, TEST2, TEST3, PROJ, j;
float sum, aveg;
float temp1, temp2, temp, temp3;
int total1=0, total2=0, total3=0, total4=0, total5=0, total6=0, total7=0, total8=0;

FILE *in; // declare input data file //
in = fopen( “project1.txt”, “r” ); // assign input data file //

printf(“\n \n”);

while(!feof(in)) // read input datafile and display until end of file //
{
for(i=1; i<27; i=i+1)
{
fscanf(in ,"%s %f %f %f %f %f %f", &MATRICS[i], &MANUAL[i], &CAD[i], &TEST1[i], &TEST2[i], &TEST3[i], &PROJ[i]);
MAN[i] = MANUAL[i]*.2;
TEST[i] = ((TEST1[i]*.1) + (TEST2[i]*.1) + (TEST3[i]*.2));
PRO[i] = PROJ[i]*.3;
j[i] = MAN[i] + CADK[i] + TEST[i] + PRO[i];

}
}

for (M=1; M<26; M=M+1) // start sorting process //
{
for (i=1; i<26; i=i+1)
{
if (j[i] < j[i+1]) // "<" Indicates for Descending Order //
{
temp=j[i];
j[i]=j[i+1];
j[i+1]=temp;

temp1=MAN[i];
MAN[i]= MAN[i+1];
MAN[i+1]= temp1;

temp3=TEST[i];
TEST[i]= TEST[i+1];
TEST[i+1]= temp3;

strcpy(temp4, MATRICS[i]);
strcpy(MATRICS[i], MATRICS[i+1]);
strcpy(MATRICS[i+1], temp4);

}

}
}

for(i=1; i=80)
printf(” A”);

else if(round(j[i])>=75 && (j[i]=70 && (j[i]=65 && (j[i]=60 && (j[i]=55 && (j[i]=50 && (j[i]<55))
printf(" C");

else
printf(" FAIL");

}
for(i=1;i=80)
{
total1 += 1;
}

else if((j[i]>=75) && (j[i]=70) && (j[i]=65) && (j[i]=60) && (j[i]=55) && (j[i]=50) && (j[i]<55))
{
total7 += 1;
}

else
{
total8 += 1;
}

}

printf("\n\n\n *****Statistics Of Results!!!*****");

printf("\n\n Total Number Of Students: 26");

for(i=1; i=80)

else if((aveg>=75) && (aveg=70) && (aveg=65) && (aveg=60) && (aveg=55) && (aveg=50) && (aveg<55))

else
printf("\nFAIL");

printf("\n Number Of A : %i", total1);
printf("\n Number Of A- : %i", total2);
printf("\n Number Of B+ : %i", total3);
printf("\n Number Of B : %i", total4);
printf("\n Number Of B- : %i", total5);
printf("\n Number Of C+ : %i", total6);
printf("\n Number Of C : %i", total7);
printf("\n Number Of 'Fail': %i", total8);

fclose(in);
}

6. Judy Nekoye says:

Hey, kindly help me with this: Write a pseudocode that multiply positive integers x and y by using addition and subtraction only

• Venkatesh Macha says:

Hi Judy,

#include <stdio.h>
int main(void) {

int x, y, i, mul=0;
printf("Enter x and y values : ");
scanf("%d%d",&x,&y);

for(i=1;i<=y;i++)
{
mul = mul + x;
}
printf("Multiplication is : %d \n",mul);
return 0;
}

Pseudocode:
1) Take the input from user and store them in x and y.
2) Now create a for loop, That will loop from 1 to the y.
3) For each iteration we are going to add x to mul. Mul is variable which is initially 0 and we are adding x to mul. Means we are
multiplying the value.
4) This process will repeat until we reach the y. Once we reach, Loop will break and Multiplication value is stored in variable mul
5) display the mul value on the console.

cheers,
Venkey.