We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
  • Hackerrank Home
  • Prepare
    NEW
  • Certify
  • Compete
  • Career Fair
  • Hiring developers?
  1. Prepare
  2. Tutorials
  3. 30 Days of Code
  4. Day 1: Data Types
  5. Discussions

Day 1: Data Types

Problem
Submissions
Leaderboard
Discussions
Editorial
Tutorial

Sort 3786 Discussions, By:

recency

Please Login in order to post a comment

  • sabarigiresan
    2 days ago+ 0 comments

    import java.io.; import java.util.;

    public class Solution {

    public static void main(String[] args) {
        int i=4;
        double d=4.0;
        String s="HackerRank";
        Scanner sc = new Scanner(System.in);
        int i2=sc.nextInt();
        double d2=sc.nextDouble();
        sc.nextLine();
        String s2=sc.nextLine();
        System.out.println(i+i2);
        System.out.println(d+d2);
        System.out.println(s+" "+s2);
        sc.close();
    }
    

    }

    0|
    Permalink
  • morshed_ipe05
    2 days ago+ 0 comments

    Here is my solution in Java:

    public class Solution {

    public static void main(String[] args) {
        /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */
    
        // declaire first vars
        int i = 4;
        double d = 4.0;
        String s = "HackerRank ";
        Scanner scan = new Scanner(System.in);
    
        //declaire second vars
        int a = 12;
        double b = 4.0;
        String c = "is the best place to learn and practice coding!";
    
        // read and save vars
        a = scan.nextInt();
        b = scan.nextDouble();
        scan.nextLine();
        c = scan.nextLine();
    
        // print sum
        System.out.println(i+a);
        System.out.println(d+b);
        s = s+c;
        System.out.print(s);
        scan.close();    
    }
    

    }

    0|
    Permalink
  • imranansari9836
    6 days ago+ 1 comment

    Java : int num; double point; String words;

    num = scan.nextInt();
    point = scan.nextDouble();
    scan.nextLine();
    words = scan.nextLine();
    
    s = s+words;
    System.out.println(num+i);
    System.out.println(point+d);
    System.out.print(s);
    
    0|
    Permalink
  • sakalukubuku1210
    1 week ago+ 1 comment

    why can't i use cin and getline() together in c++?

    0|
    Permalink
  • percu4life
    1 week ago+ 0 comments

    i = 4 d = 4.0 s = 'HackerRank '

    Declare second integer, double, and String variables.

    i = 4 d = 4.0 s = 'HackerRank '

    Read and save an integer, double, and String to your variables.

    i2 = input() d2 = input() s2 = input()

    Print the sum of both integer variables on a new line.

    print(i + int(i2))

    Print the sum of the double variables on a new line.

    print(d + float(d2))

    Concatenate and print the String variables on a new line

    The 's' variable above should be printed first.

    print (s + str(s2))

    0|
    Permalink
Load more conversations

Need Help?


View tutorial
View editorial
View top submissions
  • Blog
  • Scoring
  • Environment
  • FAQ
  • About Us
  • Support
  • Careers
  • Terms Of Service
  • Privacy Policy