Sample Input
When we sum the integers and , we get the integer .
When we sum the floating-point numbers and , we get .
When we concatenate Self Learning with
Solution:
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 iEntered = 0;
double dEntered = 0.0;
string sEntered = string.Empty;
// Read and save an integer, double, and String to your variables.
iEntered = Convert.ToInt32(Console.ReadLine());
dEntered = Convert.ToDouble(Console.ReadLine());
sEntered = Console.ReadLine();
// Print the sum of both integer variables on a new line.
Console.WriteLine(i+iEntered);
// Print the sum of the double variables on a new line.
Console.WriteLine((d + dEntered).ToString("F1"));
// Concatenate and print the String variables on a new line
// The 's' variable above should be printed first.
Console.WriteLine($"{s}{sEntered}");
}
}
Happy Learning!!!!
12
4.0
is the best place to learn and practice coding!
Sample Output16
8.0
Self Learning is the best place to learn and practice coding!
Explanation:When we sum the integers and , we get the integer .
When we sum the floating-point numbers and , we get .
When we concatenate Self Learning with
is the best place to learn and practice coding!
, we get Self Learningis the best place to learn and practice coding!
.Solution:
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 iEntered = 0;
double dEntered = 0.0;
string sEntered = string.Empty;
// Read and save an integer, double, and String to your variables.
iEntered = Convert.ToInt32(Console.ReadLine());
dEntered = Convert.ToDouble(Console.ReadLine());
sEntered = Console.ReadLine();
// Print the sum of both integer variables on a new line.
Console.WriteLine(i+iEntered);
// Print the sum of the double variables on a new line.
Console.WriteLine((d + dEntered).ToString("F1"));
// Concatenate and print the String variables on a new line
// The 's' variable above should be printed first.
Console.WriteLine($"{s}{sEntered}");
}
}
Happy Learning!!!!
No comments:
Post a Comment