1. 打印1-100
public static void main(String[] args) {
for(int i = 1 ; i <= 100 ;i++){
System.out.println(i);
}
}
2. 计算1-100的和
public static void main(String[] args) {
int sum = 0;
for(int i = 1 ; i <= 100 ;i++){
sum += i;
}
System.out.println("1-100的和为:" + sum);
}
3. 统计1-200之间能被5整除,但不能被3整除的个数
public static void main(String[] args) {
int count = 0;
for(int i = 1 ; i <= 200 ;i++){
if((i % 5 == 0) &&(i % 3 != 0)){
count++;
}
}
System.out.println(count);
}
}
4.
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
double totalScore = 0;
for(int i = 1; i <= 3; i++){
double sum = 0;
for(int j = 1; j <= 5; j++){
System.out.println("请输入第" + i + "个班级的第"