-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDay01_prob1.java
More file actions
53 lines (36 loc) · 1016 Bytes
/
Day01_prob1.java
File metadata and controls
53 lines (36 loc) · 1016 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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/*
Write a program to take the 2 inputs of integer type from the user. Display the values separated by symbol ‘-’ if the values are positive otherwise display the message “Invalid Input”.
Input Format
Your program should take at least 2 inputs of integer type.
Constraints
Input should be positive integers
Output Format
Output should be the input values separated by ‘-‘ or “Invalid Input” message if any input is negative.
Sample Input 0
10
2
Sample Output 0
10-2
Sample Input 1
20
-10
Sample Output 1
Invalid Input
*/
// Kirtan Jain
// Display of two positive user taken number inputs with '-' sign in between.
import java.io.*;
import java.util.*;
public class Solution {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int a=sc.nextInt();
int b=sc.nextInt();
if(a>=0 && b>=0){
System.out.print(a+"-"+b);
}
else{
System.out.print("Invalid Input");
}
}
}