Skip to content

Commit 723d0d4

Browse files
authored
Java Program - Min Number between 2 number I/P
Java Program - Minimum Number between 2 number by taking user input
1 parent 98192e4 commit 723d0d4

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

Test18_Min_number_input.java

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// Find Minimum number between two Numbers by taking User Input
2+
package com.test.Basic_Java_Programs;
3+
4+
import java.util.Scanner;
5+
6+
public class Test18_Min_number_input
7+
{
8+
public static void main(String[] args)
9+
{
10+
int a, b;
11+
12+
System.out.print("Enter two Numbers : ");
13+
14+
Scanner sc = new Scanner(System.in);
15+
16+
a = sc.nextInt();
17+
18+
b = sc.nextInt();
19+
20+
if (a < b)
21+
{
22+
System.out.println(a);
23+
}
24+
else
25+
{
26+
System.out.println(b);
27+
}
28+
29+
}
30+
31+
}
32+
33+
34+
/* Output:
35+
36+
Enter two Numbers : 50 100
37+
50
38+
39+
*/

0 commit comments

Comments
 (0)