本帖最后由 gabriel2016 于 2015-10-11 15:46 编辑
//
// main.m
// 测试题7
//输入一个整数score代表分数,根据分数输出等级A-E (C语言编程题)
// A:90~100
// B:80~89
// C:70~79
// D:60~69
// E:0~60
//
// Created by Gabriel He on 10/8/15.
// Copyright © 2015 Gabriel He. All rights reserved.
//
#import <Foundation/Foundation.h>
int main(int argc, const char * argv[]) {
@autoreleasepool {
int score;
scanf("%d", &score);
if (score<0 || score>100) {
printf("输入有误!\n");
}else if (score>=90 && score<=100)
{
printf("A\n");
}else if (score>=80 && score<90)
{
printf("B\n");
}else if (score>=70 && score<80)
{
printf("C\n");
}else if (score>=60 && score<70)
{
printf("D\n");
}else if (score>=0 && score<=60)
{
printf("E\n");
}
}
return 0;
}
|
|