C program to calculate the Grade of Student using Percentage | Grading program in C
Description:
Algorithm :
Flow Chart :
Program :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
#include <stdio.h> int main(void) { int num; printf("Enter your mark "); scanf("%d",&num); printf(" You entered %d Marks n", num); // printing outputs if(num >= 80){ printf(" You got A grade n"); // printing outputs } else if ( num >=60){ // Note the space between else & if printf(" You got B grade n"); } else if ( num >=40){ printf(" You got C grade n"); } else if ( num < 40){ printf(" You Failed in this exam n"); printf(" Better Luck Next Time n"); } return 0; } |
Output :
![]() |
Output of Student Grading Program |
Related Programs :
- C program to Convert Temperature.
- C program to understand type conversation.
- finding Largest of two numbers using conditional operator in C.
- C program to calculate the simple Interest,
- C program to understand Size of Operator
- 100 + More C programs
Draw a flowchart to print ‘A’ grade if marks is greater than 50 else print ‘B’ marks is greater than 30 otherwise fail
Hello please help me
Find the %mark secured by a student given all marks write it algorithm
hey guys can u help me in this problem
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[26][31], temp4[10], temp5[10];
int i, M, N, O, P, count;
float MANUAL[26], CAD[26], TEST1[26], TEST2[26], TEST3[26], PROJ[26], j[26];
float MAN[26], CADK[26], TEST[26], PRO[26];
float sum, aveg;
float temp1, temp2, temp, temp3;
float add;
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;
CADK[i] = CAD[i]*.1;
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;
temp2=CADK[i];
CADK[i]= CADK[i+1];
CADK[i+1]= temp2;
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)
printf(“\n Average Grade: A\n”);
else if((aveg>=75) && (aveg=70) && (aveg=65) && (aveg=60) && (aveg=55) && (aveg=50) && (aveg<55))
printf("\n Average Grade: C-");
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);
}
Hey, kindly help me with this: Write a pseudocode that multiply positive integers x and y by using addition and subtraction only
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.