1. 程式人生 > >C語言輸入成績等級輸出對應分數段

C語言輸入成績等級輸出對應分數段

#include <stdio.h>
#include <stdlib.h>

/* run this program using the console pauser or add your own getch, system("pause") or input loop */

int main(int argc, char *argv[]) {
	int chengji;
	printf("請輸入成績:");
	scanf("%C",&chengji);
	switch(chengji)
	{ 
	case 'A':printf("85-100\n");break; 
	case 'B':printf("70-84\n");break;
	case 'C':printf("60-69\n");break;
	case 'D':printf("<60\n");break;
	default: printf("輸入錯誤。\n");
	}
	 
	return 0;
}