Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ConsoleCalculator_by_Godness
- {
- public class Program
- {
- static void Main(string[] args)
- {
- n();
- Console.ReadKey();
- }
- public static int n()
- {
- //Обьявление переменных куда будут записываться числа
- char operators;
- double First;
- double Second;
- double result;
- //Конвертирование в консоль(сделать так чтобы можно было вводить числа в консоль, записывание)
- Console.WriteLine("Введите оператор");
- operators = Convert.ToChar(Console.ReadLine());
- Console.WriteLine("Введите первое число", ConsoleColor.Red);
- First = Convert.ToDouble(Console.ReadLine());
- Console.WriteLine("Введите второе");
- Second = Convert.ToDouble(Console.ReadLine());
- if (operators == '+')
- {
- result = First + Second;
- Console.WriteLine("Сумма чисел " + First + " и " + Second + " = " + result);
- //Почему (int)? Да блядская визуалка говорит что result нельзя в int переобразовать, вот я и привел тип int
- }
- if (operators == '-')
- {
- result = First - Second;
- Console.WriteLine("Результат вычитания чисел " + First + " - " + Second + " = " + result);
- }
- if (operators == '*')
- {
- result = First * Second;
- Console.WriteLine("Результат умножения двух чисел " + First + " * "+ Second + " = " + result);
- }
- return n();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement