要考虑正是是两位以上的情况
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
String str;
String[] s = new String[3];
Scanner input = new Scanner(System.in);
int a, b, c, t;
str = input.nextLine();
s = str.split(","); //将str以,为分隔符分成若干字符串;
a = Integer.parseInt(s[0]);
b = Integer.parseInt(s[1]);
c = Integer.parseInt(s[2]);
t = a;
if(t < b) {
t = b;
}
if(t < c) {
t = c;
}
System.out.println("max="+t);
}
}
本文介绍了一个简单的C语言程序,该程序用于接收三个整数作为输入,并输出这三个数中的最大值。程序通过读取一行包含三个由逗号分隔的整数的输入,然后使用条件语句来确定并打印最大的那个数。
1042

被折叠的 条评论
为什么被折叠?



