Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Program
- {
- class Program
- {
- static void Main(string[] args)
- {
- string choice;
- double numberOne;
- bool resultOne;
- do
- {
- Console.Write("Enter A:");
- resultOne = Double.TryParse(Console.ReadLine(), out numberOne);
- }
- while (!resultOne);
- double numberTwo;
- bool resultTwo;
- do
- {
- Console.Write("Enter B:");
- resultTwo = Double.TryParse(Console.ReadLine(), out numberTwo);
- }
- while (!resultTwo);
- do
- {
- Console.WriteLine("Methods: +, -, *, /, %");
- Console.Write("Choose method:");
- string method = Console.ReadLine();
- if (method == "+")
- {
- Console.WriteLine("Addition:" + (numberOne + numberTwo));
- }
- else if (method == "-")
- {
- Console.WriteLine("Substraction:" + (numberOne - numberTwo));
- }
- else if (method == "*")
- {
- Console.WriteLine("Multiplication:" + (numberOne * numberTwo));
- }
- else if (method == "/")
- {
- Console.WriteLine("Division:" + (numberOne / numberTwo));
- }
- else if (method == "%")
- {
- Console.WriteLine("Modulus:" + (numberOne % numberTwo));
- }
- else
- Console.WriteLine("Not existing method. Error 404.");
- Console.WriteLine("To continue choose different method.");
- Console.WriteLine("To quit type exit.");
- choice = Console.ReadLine();
- }
- while(!choice.Equals("exit"));
- {
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement