import java.util.Scanner;
public class MaxOfThreeNumbers
{
public static void main(String[] args)
{
Scanner keyboard = new Scanner (System.in);
System.out.println("Enter three number:");
int firstNumber = keyboard.nextInt();
int secondNumber = keyboard.nextInt();
int thirdNumber = keyboard.nextInt();
int temp=firstNumber;
if(secondNumber>=temp)
{temp=secondNumber;}
if(thirdNumber>=temp)
{temp=thirdNumber;}
System.out.println("the max of three number is : "+temp);
}
}
public class MaxOfThreeNumbers
{
public static void main(String[] args)
{
Scanner keyboard = new Scanner (System.in);
System.out.println("Enter three number:");
int firstNumber = keyboard.nextInt();
int secondNumber = keyboard.nextInt();
int thirdNumber = keyboard.nextInt();
int temp=firstNumber;
if(secondNumber>=temp)
{temp=secondNumber;}
if(thirdNumber>=temp)
{temp=thirdNumber;}
System.out.println("the max of three number is : "+temp);
}
}
結果:
沒有留言:
張貼留言