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.
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);
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Day 1: Data Types
You are viewing a single comment's thread. Return to all 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 ";