Sort by

recency

|

3960 Discussions

|

  • + 0 comments
    // Read and save an integer, double, and String to your variables  
    // write your code below this it is a simple and easy solution.
    
    
         String str = "is the best place to learn and practise coding!";
        a = scan.nextInt();
        b = scan.nextDouble();
        scan.nextLine(); // after reading double , it is used to avoid issue before reading a string
        str = scan.nextLine();
    
        System.out.println(i + a);
        System.out.println(d + b);
        System.out.println(s + str);        
    
  • + 0 comments

    "Complete the code in the editor below. The variables , , and are already declared and initialized for you. You must:"

    In java 15 version there is no variables declared.

  • + 1 comment
    i = 4
    d = 4.0
    s = 'HackerRank '
    
    integer_var = int(input())
    integer_doub = float(input())
    string = input()
    
    sum_int = i + integer_var
    print(sum_int)
    
    sum_double = d + integer_doub
    print(sum_double)
    
    
    print(f"{s}{string}")
    
  • + 0 comments

    Solution in JavaScript :

    // Declare second integer, double, and String variables. let secondInt; let secondDouble; let secondString

    // Read and save an integer, double, and String to your variables.
    secondInt = parseInt(readLine());
    secondDouble = parseFloat(readLine());
    secondString = readLine();
    
    // Print the sum of both integer variables on a new line.
    console.log(i + secondInt);
    
    // Print the sum of the double variables on a new line.
    console.log((d + secondDouble).toFixed(1));
    
    // Concatenate and print the String variables on a new line
    // The 's' variable above should be printed first.
    console.log(s + secondString);
    
  • + 0 comments

    in java7`

                int a = scan.nextInt();``
          double b = scan.nextDouble();
          scan.nextLine();
          b+=d;
          String ss =scan.nextLine();
          System.out.println (i+a +"\n"+ b +"\n"+ s+ss );