Hello, I’m working on this task:
Your program should read two integers each from the prompt. Then, it should output the sum, difference, product, and quotient of those numbers. If the second number is zero, the program should output the sum, the difference, and the product, but instead of the quotient, it should print “Can’t divide by zero!”
Example 1:
>12
>4
16
8
48
3
Example 2:
>12
>0
12
12
0
Can’t divide by zero!
Here is my code:
namespace OpenAdvancedInfo
{
class MathOperations
{
static void Main(string[] args)
{
// Write your code hereYour program should read two integers each from the prompt. Then, it should output the sum, difference, product, and quotient of those numbers. If the second number is zero, the program should output the sum, the difference, and the product, but instead of the quotient, it should print "Can't divide by zero!"
Console.WriteLine("Please enter your first number: ");
int a = int.Parse(Console.ReadLine());
Console.WriteLine("Please enter your second number: ");
int b = int.Parse(Console.ReadLine());
Console.WriteLine(a + b);
Console.WriteLine(a - b);
Console.WriteLine(a * b);
if (b != 0)
{
Console.WriteLine(a / b);
}
else
{
Console.WriteLine("Sorry, can't divide by zero!");
}
}
}
}
This code runs in VS Code, and I’m not sure what the issue is with CodeEasy. Any thoughts?