-
Notifications
You must be signed in to change notification settings - Fork 0
/
If.java
39 lines (34 loc) · 1.09 KB
/
If.java
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
33
34
35
36
37
38
import java.util.Scanner;
public class If
{
public static void main(String args[])
{
int one;
int two;
Scanner input = new Scanner(System.in);
System.out.print("Enter a number: ");
one = input.nextInt();
System.out.print("Enter another number: ");
two = input.nextInt();
if(one == two)
{
System.out.println("The numbers entered are equal.");
}
if(one != two)
{
int multiple = one % two;
if(multiple == 0)
{
System.out.println("The first number entered is a multiple of the second number entered");
}
else
{
System.out.println("The first number entered is not a multiple of the second number entered");
}
}
//Enter values 9 and 3; Output should be 'The first number entered is a multiple of the second number entered';
//Enter values 4 and 3; Output should be 'The first number entered is not a multiple of the second number entered';
//Enter values 3 and 9; Output should be 'The first number entered is not a multiple of the second number entered';
//Enter values 3 and 3; Output should be 'The numbers entered are equal.';
}
}