-
Notifications
You must be signed in to change notification settings - Fork 1
/
Day-1.java
33 lines (26 loc) · 1.07 KB
/
Day-1.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
import java.util.*;
public class Solution {
public static void main(String[] args) {
int i = 4;
double d = 4.0;
String s = "HackerRank ";
Scanner scan = new Scanner(System.in);
/* Declare second integer, double, and String variables. */
int i2;
double d2;
String s2;
/* Read and save an integer, double, and String to your variables.*/
i2 = scan.nextInt();
d2 = scan.nextDouble();
scan.nextLine(); // read the rest of the line of input (newline character after the double token).
s2 = scan.nextLine();
/* Print the sum of both integer variables on a new line. */
System.out.println(i + i2);
/* Print the sum of the double variables on a new line. */
System.out.println(d + d2);
/* Concatenate and print the String variables on a new line integer variables on a new line;
the 'string` variable above should be printed first. */
System.out.println(s + s2);
scan.close();
}
}