Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Console.ForegroundColor = ConsoleColor.Yellow;
- Console.Title("Калькулятор");
- Console.WriteLine("Выберите тип калькуляции:");
- Console.WriteLine("1. Сложение");
- Console.WriteLine("2. Вычитание");
- Console.WriteLine("3. Умножение");
- Console.WriteLine("4. Деление");
- Console.Write("Тип: ");
- string type = Console.ReadLine();
- if(type == "1")
- {
- Console.Clear();
- Console.ForegroundColor = ConsoleColor.DarkYellow;
- Console.Write("Первое: ");
- string first = Console.ReadLine();
- Console.Write("Второе: ");
- string post = Console.ReadLine();
- int fst = Convert.ToInt32(first);
- int pst = Convert.ToInt32(post);
- Console.WriteLine(String.Format("Получилось: {0}", fst + pst));
- Console.ReadKey();
- }
- if(type == "2")
- {
- Console.Clear();
- Console.ForegroundColor = ConsoleColor.DarkYellow;
- Console.Write("Первое: ");
- string first = Console.ReadLine();
- Console.Write("Второе: ");
- string post = Console.ReadLine();
- int fst = Convert.ToInt32(first);
- int pst = Convert.ToInt32(post);
- Console.WriteLine(String.Format("Получилось: {0}", fst - pst));
- Console.ReadKey();
- }
- if(type == "3")
- {
- Console.Clear();
- Console.ForegroundColor = ConsoleColor.DarkYellow;
- Console.Write("Первое: ");
- string first = Console.ReadLine();
- Console.Write("Второе: ");
- string post = Console.ReadLine();
- int fst = Convert.ToInt32(first);
- int pst = Convert.ToInt32(post);
- Console.WriteLine(String.Format("Получилось: {0}", fst * pst));
- Console.ReadKey();
- }
- if(type == "4")
- {
- Console.Clear();
- Console.ForegroundColor = ConsoleColor.DarkYellow;
- Console.Write("Первое: ");
- string first = Console.ReadLine();
- Console.Write("Второе: ");
- string post = Console.ReadLine();
- int fst = Convert.ToInt32(first);
- int pst = Convert.ToInt32(post);
- Console.WriteLine(String.Format("Получилось: {0}", fst / pst));
- Console.ReadKey();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement