-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDay09_prob1.java
45 lines (31 loc) · 983 Bytes
/
Day09_prob1.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
39
40
41
42
43
44
45
/*
Write a program to take one input of int type from the user. If the value is positive convert it into double and display it, otherwise display the message “Invalid Input”.
Input Format
Your program should take one input of int type.
Constraints
Input should be positive integer
Output Format
If the input value is positive number (including 0) display the value in double type otherwise display the message “Invalid Input”.
Sample Input 0
5
Sample Output 0
5.0
Sample Input 1
-1
Sample Output 1
Invalid Input
*/
// kirtan jain
import java.io.*;
import java.util.*;
public class Solution {
public static void main(String[] args) {
/* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
if(n>0)
System.out.println((double)n);
else
System.out.println("Invalid Input");
}
}