java编程基础篇--> 编写一个程序,从键盘输入三个整数,求三个整数中的最小值。

编写一个程序,从键盘输入三个整数,求三个整数中的最小值。 package Exam01;import java.util.Scanner;public class Topic03 {public static void main(String[] args) {// TODO Auto-generated method stubint a,b,c;//输入Scanner input = new Scanner(System.in);System.out.println("请输入一个整数:");a = input.nextInt();System.out.println("请输入二个整数:");b = input.nextInt();System.out.println("请输入三个整数:");c = input.nextInt();System.out.println(a+","+b+","+c);int temp;int min;if(a>b){temp = a;a = b;b = temp;}if(a>c){min = b;}else{min = a;}if(min>c){min = c;}System.out.println("最小值:" + min);}}

你可能感兴趣的:(Java)