数组Array练习-创新互联
package com.sss.shang.testday1;
import java.util.Scanner;
public class ArrayTest {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner scanner = new Scanner(System.in);
System.out.println("input num");
int num = scanner.nextInt();
int[] score = new int[num];
//输入成绩
for (int i = 0; i< num; i++) {
System.out.println("input "+(i+1)+"score");
score[i] = scanner.nextInt();
}
//找出大成绩
int numFlag = 0;
for (int i = 0; i< num; i++) {
if (numFlag< score[i]) {
numFlag = score[i];
}
}
//等级
for (int i = 0; i< num; i++) {
if (score[i] >= numFlag-10) {
System.out.println((i+1)+"位等级"+"A");
}else if (score[i] >= numFlag-20) {
System.out.println((i+1)+"位等级"+"B");
}else if (score[i] >= numFlag-30) {
System.out.println((i+1)+"位等级"+"C");
}else {
System.out.println((i+1)+"位等级"+"D");
}
}
}
}
你是否还在寻找稳定的海外服务器提供商?创新互联www.cdcxhl.cn海外机房具备T级流量清洗系统配攻击溯源,准确流量调度确保服务器高可用性,企业级服务器适合批量采购,新人活动首月15元起,快前往官网查看详情吧
文章题目:数组Array练习-创新互联
链接URL:http://azwzsj.com/article/diddds.html