0% found this document useful (0 votes)
37 views1 page

C Program for Student Grading System

This C program allows a user to input their coursework and final exam marks. It then calculates the total marks and determines if the student passed or failed based on passing thresholds for the individual components and total score. If the individual components or total is near the passing threshold, edge cases are handled to determine a pass or fail. The output prints the student's score and result.

Uploaded by

Moris FreeMan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
37 views1 page

C Program for Student Grading System

This C program allows a user to input their coursework and final exam marks. It then calculates the total marks and determines if the student passed or failed based on passing thresholds for the individual components and total score. If the individual components or total is near the passing threshold, edge cases are handled to determine a pass or fail. The output prints the student's score and result.

Uploaded by

Moris FreeMan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

File: /home/moris/Desktop/projects/grading.

c Page 1 of 1

#include <stdio.h>
#include <stdlib.h>

/* ARWAI MORISH 18/U/ITD/142/GV*/


/* Student grading program in c*/

int main(int argc, char *argv[]) {

int coursework, final_exam, total_marks;

printf("WELCOME TO THE STUDENT GRADING SYSTEM\n");


printf("\nEnter your coursework mark: ");
scanf("%d", &coursework);

//coursework can not be less than 0 or greater than 20

if(coursework>30||coursework<0){
printf("\nInvalid coursework mark, enter a number from 0 to 30\n");
exit(0);
}
printf("\nEnter your finalexamination mark: ");
scanf("%d", &final_exam);

//final examamination can not be less than 0 or more than 70

if(final_exam>70||final_exam<0){
printf("\nInvalid final examination mark, enter a number from 0 to
70\n");
exit(0);
}

total_marks=coursework+final_exam;

if(coursework>=15 && final_exam>=15 && total_marks>=40){

printf("\nYour score is %d, you passed\n", total_marks);

}
else if(coursework>=15 && final_exam>=15 && total_marks==39){

total_marks=40;
printf("\nyou were compensated your total mark is %d, you
passed\n", total_marks);
}

else if(coursework<15 && final_exam<15){

total_marks=coursework+final_exam;
printf("\nyou got %d, you failed\n", total_marks);
}

else if(total_marks>=40 && coursework<15 || total_marks>=40 &&


final_exam<15){

total_marks=39;
printf("\nyou got a technical failure of %d, you failed\n",
total_marks);
}

else{

printf("\nyour score is %d, you failed\n", total_marks);

}
return 0;
}

You might also like