Click Here to see the problem detail.
Solution
This is so much straight forward problem. So the source code is given below with out any explanation.
Source Code
#include<stdio.h> #include<stdlib.h> #include<ctype.h> #include<string.h> int main () { int term1,term2,final,attendance,class_test[3],temp; int test,t,i,total,k,m; char grade[100][4]; scanf("%d",&test); t=test; i=0; while(test) { scanf("%d %d %d %d ",&term1,&term2,&final,&attendance); scanf("%d %d %d",&class_test[0],&class_test[1],&class_test[2]); for(k=0;k<3;k++) { for(m=k+1;m<3;m++) { if(class_test[k]>class_test[m]) { temp=class_test[k]; class_test[k]=class_test[m]; class_test[m]=temp; } } } total=term1+term2+final+attendance+((class_test[2]+class_test[1])/2); if(total>=90) strcpy(grade[i],"A"); else if(total>=80 && total<90) strcpy(grade[i],"B"); else if(total>=70 && total<80) strcpy(grade[i],"C"); else if(total>=60 && total<70) strcpy(grade[i],"D"); else if(total<60) strcpy(grade[i],"F"); i++; test--; } for(i=0;i<t;i++) { printf("Case %d: %s\n",i+1,grade[i]); } return 0; }