比较两数的大小

import java.util.Scanner;
public class Mm{
public static void main(String args[])
{

Scanner input=new Scanner(System.in);
int x,y;
int max=0;

System.out.print("请输入第一个数:");
x=input.nextInt();

System.out.print("请输入第二个数:");
y=input.nextInt();
if(x>y)
max=x;
else
max=y;

System.out.printf("其中最大数是:%d\n",max);
}
}

运行效果:

posted on 2017-05-21 19:11  Iitb  阅读(118)  评论(0)    收藏  举报

导航