You are viewing a single comment's thread. Return to all comments →
import java.util.Scanner;
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 variables int i2; double d2; String s2; // Read inputs i2 = scan.nextInt(); d2 = scan.nextDouble(); scan.nextLine(); // consume leftover newline s2 = scan.nextLine(); // Print results System.out.println(i + i2); System.out.printf("%.1f\n", d + d2); System.out.println(s + s2); scan.close(); }
}
Seems like cookies are disabled on this browser, please enable them to open this website
Day 1: Data Types
You are viewing a single comment's thread. Return to all comments →
import java.util.Scanner;
public class Solution { public static void main(String[] args) { int i = 4; double d = 4.0; String s = "HackerRank ";
}