Skip to content

Instantly share code, notes, and snippets.

@raryosu
Last active August 29, 2015 14:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save raryosu/fcb02a4e692dac819e08 to your computer and use it in GitHub Desktop.
Save raryosu/fcb02a4e692dac819e08 to your computer and use it in GitHub Desktop.
#include <stdio.h>
int main() {
int m, f, r;
while(1) {
/* 各データセットの読み込み */
scanf("%d %d %d", &m, &f, &r);
if(m==-1 && f==-1 && r==-1) {
break;
} else if(m==-1 || f==-1) { /* 成績がFの時 */
printf("F\n");
} else if(m+f >= 80){ /* 成績がAの時 */
printf("A\n");
} else if(m+f >= 65){ /* 成績がBの時 */
printf("B\n");
} else if(m+f >= 50){ /* 成績がCの時(1) */
printf("C\n");
} else if(m+f >= 30 && r >= 50){ /* 成績がCの時(2) */
printf("C\n");
} else if(m+f >= 30 && r < 50){ /* 成績がDの時 */
printf("D\n");
} else { /* その他の時 = 成績がFの時 */
printf("F\n");
}
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment