-
Notifications
You must be signed in to change notification settings - Fork 0
/
Day1_DataType.java
43 lines (32 loc) · 1.2 KB
/
Day1_DataType.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
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
public class Day1_DataTypes {
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 ei;
double ed;
String es;
/* Read and save an integer, double, and String to your variables.*/
ei=scan.nextInt();
ed=scan.nextDouble();
scan.nextLine();
es=scan.nextLine();
// 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(i+ei);
/* Print the sum of the double variables on a new line. */
System.out.println(d+ed);
/* Concatenate and print the String variables on a new line;
the 's' variable above should be printed first. */
s=s.concat(es);
System.out.println(s);
scan.close();
}
}