Hello, I’m working on this task:
Write a program that reads two doubles from the console, each from a new line, and outputs their sum and difference. For example:
>7.1
>3.5
10.6
3.6
Here is my code:
namespace DoubleType
{
class ArithmeticOperations
{
static void Main(string[] args)
{
Console.WriteLine("first number: ");
double num1 = double.Parse(Console.ReadLine());
Console.WriteLine("second number: ");
double num2 = double.Parse(Console.ReadLine());
double sum = num1 + num2;
double diff = num1 - num2;
Console.WriteLine("the sum is " + sum);
Console.WriteLine("the difference is " + diff);
}
}
}
Can anyone please help me to solve it?