Day 1: Data Types | 30 Days of Coding | HackerRank | Java Language

**Before watching this make sure that you’ve tried enough**

import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;

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 a = scan.nextInt();
        double b = scan.nextDouble();
        scan.nextLine();
        String ch = scan.nextLine();
        /* Read and save an integer, double, and String to your variables.*/
        // Note: If you have trouble reading the entire String, please go back and review the Tutorial closely.
        a = i + a;
        /* Print the sum of both integer variables on a new line. */
        b = b + d;
        /* Print the sum of the double variables on a new line. */
        s += ch;
        /* Concatenate and print the String variables on a new line; 
        	the 's' variable above should be printed first. */
        System.out.println(a);
        System.out.println(b);
        System.out.println(s);
        scan.close();
    }
}

 

If this solution helped you, please share this with your friends.
And if you have anything to say, let me know in the comment section.
More solutions are coming so Like our Facebook page and Subscribe to our YouTube channel to stay connected.

Leave a Comment