Advertisement
SMASIF

C# - A Simple Calculator

Mar 12th, 2018
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.32 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace ConsoleApplication2
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             Console.WriteLine("Enter 1st Number: ");
  14.             int number1 = Convert.ToInt32(Console.ReadLine());
  15.             Console.WriteLine("Enter 2nd Number: ");
  16.             int number2 = Convert.ToInt32(Console.ReadLine());
  17.  
  18.            
  19.             Console.WriteLine("Addition :" + Add(number1, number2));
  20.             Console.WriteLine("Subtraction :" + Subtract(number1, number2));
  21.             Console.WriteLine("Multiplication :" + Multiply(number1, number2));
  22.             Console.WriteLine("Divide :" + Divide(number1, number2));
  23.             Console.ReadKey();
  24.         }
  25.  
  26.         static int Add(int a, int b)
  27.         {
  28.             int number = a + b;
  29.             return number;
  30.         }
  31.  
  32.         static int Subtract(int a, int b)
  33.         {
  34.             int number = a - b;
  35.             return number;
  36.         }
  37.  
  38.         static int Multiply(int a, int b)
  39.         {
  40.             int number = a * b;
  41.             return number;
  42.         }
  43.  
  44.         static int Divide(int a, int b)
  45.         {
  46.             int number = a / b;
  47.             return number;
  48.         }
  49.  
  50.  
  51.     }
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement