-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDay-01-Java-Q2
More file actions
49 lines (37 loc) · 980 Bytes
/
Day-01-Java-Q2
File metadata and controls
49 lines (37 loc) · 980 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
/*Write a program to execute the datas with the statement.
Input Format
first input corresponds to integer
second input corresponds to float
third input corresponds to char
fourth input correspond to string
fifth input correspond to String
Constraints
No Constraints
Output Format
execute the user inputs with the statemets
Sample Input 0
23
45.56
A
hello
hello world
Sample Output 0
Integer is 23
Float is 45.56
Character is A
Strings are hello and hello world.*/
# Answer
import java.io.*;
import java.util.*;
public class Day-01-JAVA-Q2 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int val = sc.nextInt();
float f = sc.nextFloat();
char c = sc.next().charAt(0);
String str1=sc.next();
sc.nextLine();
String str2=sc.nextLine();
System.out.println("Integer is "+ val+"\n"+"Float is "+ f+"\n"+"Character is "+ c+"\n"+ "Strings are "+ str1 + " and "+ str2);
}
}