• + 0 comments

    C# code: using System; using System.Collections.Generic; using System.IO;

    class Solution { static void Main(String[] args) { int i = 4; double d = 4.0; string s = "HackerRank ";

        // Declare second integer, double, and String variables.
        int userInt;
        double userDouble;
        string userString;
    
        // Read input for the declared variables.
        userInt = Convert.ToInt32(Console.ReadLine());       // Read an integer
        userDouble = Convert.ToDouble(Console.ReadLine());   // Read a double
        userString = Console.ReadLine();                     // Read a string
    
        // Perform the operations and print the results
        // Print the sum of integer variables
        Console.WriteLine(i + userInt);
    
        // Print the sum of double variables to one decimal place
        Console.WriteLine($"{d + userDouble:F1}");
    
        // Concatenate and print the strings
        Console.WriteLine(s + userString);