Computer Science, asked by omi414, 7 months ago

Write a program in java to input three numbers and display the greatest number (using or without using function.

Answers

Answered by Nilanjit
3

import java.util.Scanner;

public class Biggest_Number

{

public static void main(String[] args)

{

int x, y, z;

Scanner s = new Scanner(System.in);

System.out.print("Enter the first number:");

x = s.nextInt();

System.out.print("Enter the second number:");

y = s.nextInt();

System.out.print("Enter the third number:");

z = s.nextInt();

if(x > y && x > z)

{

System.out.println("Largest number is:"+x);

}

else if(y > z)

{

System.out.println("Largest number is:"+y);

}

else

{

System.out.println("Largest number is:"+z);

}

}

}

Similar questions