Day 1: Data Types Solution in C# & Python | 30 Days of Code

CodeWithHonor
3 min readDec 23, 2022

Screenshot for those who want to take a look at the question:

Solution in C#

To solve the “Day 1: Data Types” problem on HackerRank using C#, you need to write a program that reads four lines of input from the console and performs the following actions:

  1. Declares a variable i of type int and assigns it the value of the first line of input.
  2. Declares a variable d of type double and assigns it the value of the second line of input.
  3. Declares a variable s of type string and assigns it the value of the third line of input.
  4. Prints the sum of i plus the cast of d to an int on a new line.
  5. Prints the concatenation of s with the cast of d to a string on a new line.

Here is an example solution in C#:

using System;

namespace DataTypes
{
class Program
{
static void Main(string[] args)
{
// Read input
int i = int.Parse(Console.ReadLine());
double d = double.Parse(Console.ReadLine());
string s =…

--

--