SHARE
TWEET

Calculator

a guest Aug 20th, 2019 78 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace test
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             //variable
  14.             int choice, formula, number1, number2;
  15.  
  16.             do
  17.             {
  18.                 //give user the choices
  19.                 Console.WriteLine("1.Addition Calculator");
  20.                 Console.WriteLine("2.Multiplication Calculator");
  21.                 Console.WriteLine("3.Exit Calculator");
  22.  
  23.                 //ask user to enter their choices
  24.                 Console.Write("What is your choices: ");
  25.                 choice = int.Parse(Console.ReadLine());
  26.  
  27.                 if (choice == 1)
  28.                 {
  29.                     Console.WriteLine("Please enter 2 numbers: ");
  30.                     number1 = int.Parse(Console.ReadLine());
  31.                     number2 = int.Parse(Console.ReadLine());
  32.                     formula = number1 + number2;
  33.                 }else if (choice == 2)
  34.                 {
  35.                     Console.WriteLine("Please enter 2 numbers: ");
  36.                     number1 = int.Parse(Console.ReadLine());
  37.                     number2 = int.Parse(Console.ReadLine());
  38.                     formula = number1 * number2;
  39.                 }else
  40.                 {
  41.                     Console.WriteLine("Noob");
  42.                 }
  43.                 Console.WriteLine("Your answer is: {0}", formula);
  44.  
  45.             } while (choice != 3);
  46.         }
  47.     }
  48. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top