Showing posts with label Largest Among three numbers using Java.. Show all posts
Showing posts with label Largest Among three numbers using Java.. Show all posts

Thursday, August 13, 2020

Write a Program Find Largest Among three numbers using Java.

Find Largest Among three numbers using Java. 


EXAMPLE :-

import java.util.Scanner;
class three
{
public static void main(String args[])
{
int p,q,r;
System.out.println("Enter The Three Numbers ::");
Scanner in = new Scanner(System.in);

p = in.nextInt();
q = in.nextInt();
r = in.nextInt();

if (p > q && p > r)
System.out.println("First Number is the Largest.");
else if (q > p && q > r)
System.out.println("Second Number is the Largest.");
else if (r > p && r > q)
System.out.println("Third Number is the Largest.");
}
}


OUTPUT

Enter The Three Numbers :: 45 54 46 Second Number is the Largest.