-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDay1.java
31 lines (23 loc) · 975 Bytes
/
Day1.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
import java.util.Scanner;
public class Day1 {
public static void main(String[] args) {
int i = 4;
double d = 4.0;
String s = "HackerRank ";
Scanner scan = new Scanner(System.in);
/* Read and save an integer, double, and String to your variables.*/
int number = scan.nextInt();
double precision = scan.nextDouble();
scan.nextLine();
String string = scan.next();
// Note: If you have trouble reading the entire String, please go back and review the Tutorial closely.
/* Print the sum of both integer variables on a new line. */
System.out.println(number + i);
/* Print the sum of the double variables on a new line. */
System.out.println(precision + d);
/* Concatenate and print the String variables on a new line;
the 's' variable above should be printed first. */
System.out.println(s + string);
scan.close();
}
}