Created
April 29, 2014 11:44
-
-
Save chomado/11397775 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
char grading(int, int, int); | |
/***** メイン関数 ********/ | |
int main(void) | |
{ | |
int m, f, r; | |
while (scanf("%d %d %d", &m, &f, &r), ~m||~f||~r) { | |
printf("%c\n", grading(m, f, r)); | |
} | |
return 0; | |
} | |
/***** 成績付ける関数(((o(*゚▽゚*)o))) ****/ | |
char grading(int m, int f, int r) | |
{ | |
int sum = m+f; | |
if (m == -1 || f == -1) return 'F'; | |
else if (sum >= 80) return 'A'; | |
else if (sum >= 65) return 'B'; | |
else if (sum >= 50) return 'C'; | |
else if (sum >= 30) { | |
if (r >= 50) return 'C'; | |
else return 'D'; | |
} | |
else return 'F'; | |
return 'y'; // error | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment