Advertisement
KodingKid

C# Calculator - Basic Scripting #42(0)

Dec 2nd, 2021
248
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.63 KB | None | 0 0
  1. string val1;
  2. string val2;
  3. int res;
  4. input1 = Console.ReadLine();
  5. val1 = input1;
  6. res = Convert.ToInt32(val1);
  7. input2 = Console.ReadLine();
  8. val2 = input2;
  9. res = Convert.ToInt32(val2);
  10. Console.WriteLine("Do you want to add, subtract, divide, or multiply?");
  11. input3 = Console.ReadLine();
  12. if input3 == "Add"
  13.     Console.WriteLine(numeral1 + numeral2);
  14. if input3 == "Subtract"
  15.     Console.WriteLine(numeral1 - numeral2);
  16. if input3 == "Divide"
  17.     Console.WriteLine(numeral1 / numeral2);
  18. if input3 == "Multiply"
  19.     Console.WriteLine(numeral1 * numeral2);
  20. if else
  21.     Console.WriteLine("Sorry, I didn't understand what you inputted.");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement