Hello, I’m working on this task:
Write a program that first waits for the user to input two integers, A and B, one after the other, from the console. Then the user should input the operation “add” or “multiply”. If the user inputs “add”, output the sum of A and B. If the user answers “multiply”, output the multiplication product of A and B. For example:
>12
>3
>add
15
Here is my code:
namespace Booleans
{
public class ConsoleReadLine
{
public static void Main(string[] args)
{
string aString = Console.ReadLine();
string bString = Console.ReadLine();
int a = int.Parse(aString);
int b = int.Parse(bString);
string operation = "add";
if (operation == "add")
{
int result = a + b;
Console.WriteLine("" + result+"");
}
}
}
}
Can anyone please help me to solve it?