Sort by

recency

|

3990 Discussions

|

  • + 0 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();
    }
    

    }

  • + 0 comments

    agreed on confunsing wording

    python3

    if __name__ == '__main__':
        i = int(4)
        d = float(4.0)
        s = str('HackerRank')
        
        a = int(input().strip())
        b = float(input().strip())
        c = str(input().strip())
        
        print(i+a)
        print(b+d)
        print(s, c)
    
  • + 0 comments

    I don't know if it's just me but the wording was super confusing.

  • + 0 comments

    in C# this works

      // Declare second integer, double, and String variables.
        int secondInteger;
        double secondDouble; 
        string secondText;
    
        // Read and save an integer, double, and String to your variables.
         secondInteger = int.Parse(Console.ReadLine());
         secondDouble = double.Parse(Console.ReadLine());
         secondText = Console.ReadLine();
    
        // Print the sum of both integer variables on a new line.
        Console.WriteLine(secondInteger+i);
    
        // Print the sum of the double variables on a new line.
        double var3 = secondDouble+d;
         Console.WriteLine(var3.ToString("F1"));
    
        // Concatenate and print the String variables on a new line
        // The 's' variable above should be printed first.
        Console.WriteLine(s+""+secondText);
    
    
    }
    
  • + 0 comments

    here is Day 1 data types solution in python, java, c++, c and javascript - https://programmingoneonone.com/hackerrank-day-1-data-types-30-days-of-code-solution.html