Advertisement
Guest User

Calculator

a guest
Oct 16th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.21 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 ConsoleApp7
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             Console.WriteLine("=================================================");
  14.             Console.WriteLine("               Изберете функция:");
  15.             Console.WriteLine(" _______________________________________________");
  16.             Console.WriteLine("|                                               |");
  17.             Console.WriteLine("|   Събиране ; Изваждане ; Умножение ; Делениe  |");
  18.             Console.WriteLine("|                                               |");
  19.             Console.WriteLine("|_______________________________________________|");
  20.             string txt = Console.ReadLine();
  21.             Console.WriteLine("  ");
  22.             Console.WriteLine("Вие избрахте {0}!", txt);
  23.             Console.WriteLine("  ");
  24.             Console.Write("Изберете числото:");
  25.             var a = double.Parse(Console.ReadLine());
  26.             Console.Write("Изберете второто число:");
  27.             var b = double.Parse(Console.ReadLine());
  28.  
  29.             if (txt == "Събиране")
  30.             {
  31.                 Console.WriteLine(" ");
  32.                 Console.Write("Равно на:");
  33.                 Console.WriteLine(a + b);
  34.             }
  35.  
  36.             if (txt == "Изваждане")
  37.             {
  38.                 Console.WriteLine(" ");
  39.                 Console.Write("Равно на:");
  40.                 Console.WriteLine(a - b);
  41.             }
  42.  
  43.             if (txt == "Умножение")
  44.             {
  45.                 Console.WriteLine(" ");
  46.                 Console.Write("Равно на:");
  47.                 Console.WriteLine(a * b);
  48.             }
  49.  
  50.             if (txt == "Деление")
  51.             {
  52.                 Console.WriteLine(" ");
  53.                 Console.Write("Равно на:");
  54.                 Console.WriteLine(a / b);
  55.             }
  56.             Console.WriteLine("=================================================");
  57.                  
  58.         }
  59.     }
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement