-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathGreatest_no.java
More file actions
33 lines (29 loc) · 895 Bytes
/
Greatest_no.java
File metadata and controls
33 lines (29 loc) · 895 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// Write a Java program to take three numbers
// from the user and print the greatest number
import java.util.Scanner;
public class Greatest_no {
public static void main(String[] args)
{
Scanner s = new Scanner(System.in);
System.out.println("Find Greatest number");
System.out.println("Enter a 1st value ");
float a = s.nextFloat();
System.out.println("Enter a 2nd value ");
float b = s.nextFloat();
System.out.println("Enter a 3rd value ");
float c = s.nextFloat();
if(a>b && a>c)
{
System.out.println("1st value is Greatest number");
}
else if(b>a && b>c)
{
System.out.println("2nd value is Greatest number");
}
else
{
System.out.println("3rd value is Greatest number");
}
s.close();
}
}