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 product and quotient. If the second number is 0.0, you should output their product and then “Can’t divide by zero!” instead of the quotient. For example:
>4.4
>2.2
9.68
2
Or, if the second number is zero:
>4.4
>0
0
Can’t divide by zero!
Here is my code:
namespace DoubleType
{
class QuotientFinder
{
static void Main(string[] args)
{
double num1 = double.Parse(Console.ReadLine());
double num2 = double.Parse(Console.ReadLine());
double product = num1 * num2;
double quotient = num1 / num2;
if (a == 0.0);
{
Console.WriteLine("Can't divide by zero!");
}
else
{
Console.WriteLine( / b);
}
}
}
}
Can anyone please help me to solve it?