Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace PD3zad2
- {
- public class Program
- {
- static void Main(string[] args)
- {
- Console.WriteLine("Jakie działanie chcesz wykonać?");
- int choose = 0, a = 0, b = 0;
- double c = 0;
- while (choose != 5)
- {
- Console.WriteLine("1. Dodawanie");
- Console.WriteLine("2. Odejmowanie");
- Console.WriteLine("3. Mnożenie");
- Console.WriteLine("4. Dzielenie");
- Console.WriteLine("5. Wyjscie");
- choose = Convert.ToInt32(Console.ReadLine());
- switch (choose)
- {
- case 1:
- {
- Console.WriteLine("Podaj 1 liczbe: ");
- a = Convert.ToInt32(Console.ReadLine());
- Console.WriteLine("Podaj 2 liczbe: ");
- b = Convert.ToInt32(Console.ReadLine());
- c = a + b;
- Console.WriteLine(c);
- break;
- }
- case 2:
- {
- Console.WriteLine("Podaj 1 liczbe: ");
- a = Convert.ToInt32(Console.ReadLine());
- Console.WriteLine("Podaj 2 liczbe: ");
- b = Convert.ToInt32(Console.ReadLine());
- c = a - b;
- Console.WriteLine(c);
- break;
- }
- case 3:
- {
- Console.WriteLine("Podaj 1 liczbe: ");
- a = Convert.ToInt32(Console.ReadLine());
- Console.WriteLine("Podaj 2 liczbe: ");
- b = Convert.ToInt32(Console.ReadLine());
- c = a * b;
- Console.WriteLine(c);
- break;
- }
- case 4:
- {
- Console.WriteLine("Podaj 1 liczbe: ");
- a = Convert.ToInt32(Console.ReadLine());
- Console.WriteLine("Podaj 2 liczbe: ");
- b = Convert.ToInt32(Console.ReadLine());
- c = a / b;
- Console.WriteLine(c);
- break;
- }
- case 5:
- {
- Environment.Exit(0);
- break;
- }
- default:
- {
- Console.WriteLine("Wybrana opcja jest nie poprawna. Proszę wybrać znak od 1 do 5 w zależności co chce się wykonać");
- break;
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement