30 days of code : Day 1

https://www.hackerrank.com/domains/tutorials/30-days-of-code
Reviewing and brushing up my c# skills via HackerRank's 30 days of code challenge.

int i = 5;
double d = 5.0;
string s = "TestString";

// Read and save an integer, double, and String to your variables.
int intVar = Convert.ToInt32(Console.ReadLine());
double doubleVar = Convert.ToDouble(Console.ReadLine());
string stringVar = Console.ReadLine();

// Print the sum of both integer variables on a new line.
Console.WriteLine(i + intVar);

// Print the sum of the double variables on a new line.
Console.WriteLine((d + doubleVar).ToString("F1"));

// Concatenate and print the String variables on a new line
// The 's' variable above should be printed first.
string concatString = s + stringVar;
Console.WriteLine(concatString);

Leave a Reply

Your email address will not be published. Required fields are marked *