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;
}