Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- void main()
- {
- int i,a[5],j;
- float GPA=0.00,avrg;
- for(i=0;i<5;i++)
- {
- scanf("%d",&a[i]);
- if(a[i]<33)
- printf("F");
- {
- j=a[i]/10;
- switch(j)
- {
- case 3:printf("D\n");
- GPA=+1.00;
- break;
- case 4:printf("C\n");
- GPA=GPA+2.00;
- break;
- case 5:printf("B\n");
- GPA=GPA+3.00;
- break;
- case 6:printf("A-\n");
- GPA=GPA+3.50;
- break;
- case 7:printf("A\n");
- GPA=GPA+4.00;
- break;
- case 8:
- case 9:
- case 10:printf("A+\n");
- GPA=GPA+5.00;
- break;
- defalt:printf("ERROR");
- }
- }
- }
- avrg=GPA/5;
- printf("\nAverage is %f\n",avrg);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement