-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathps2_q3.java
More file actions
28 lines (26 loc) · 699 Bytes
/
Copy pathps2_q3.java
File metadata and controls
28 lines (26 loc) · 699 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
package com.barneel;
import java.util.Scanner;
//using comparison operators to know if given number is less than or greater than random number.
public class ps2_q3
{
public static void main(String[] args)
{
Scanner sc= new Scanner(System.in);
int max=6;
int min=1;
float a= (float) Math.floor(Math.random()*(max-min+1)+min);
float b=sc.nextFloat();
if(a<b)
{
System.out.println("entered number is smaller");
}
else if(a==b)
{
System.out.println("entered number is equal");
}
else
{
System.out.println("entered number is greater");
}
}
}