Advertisement
Guest User

Untitled

a guest
Jan 28th, 2020
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.71 KB | None | 0 0
  1. static void Main(string[] args)
  2. {
  3. string jeden, dwa;
  4. float a, b;
  5. bool y = true;
  6. if 👍
  7.  
  8. Console.Write("Podaj liczbę a: ");
  9. jeden = Console.ReadLine();
  10. Console.Write("Podaj liczbę b: ");
  11. dwa = Console.ReadLine();
  12.  
  13. if (float.TryParse(jeden, out a) & float.TryParse(dwa, out b))
  14. {
  15. Console.Write("Podaj symbol( +,-,*,/) dziaƂania : ");
  16. string dziaƂanie = Console.ReadLine();
  17. switch (dziaƂanie)
  18. {
  19. case "+":
  20. Console.WriteLine("Wynik tego dodawania to: " + (a + b));
  21. break;
  22. case "-":
  23. Console.WriteLine("Wynik tego odejmowania to: " + (a - b));
  24. break;
  25. case "*":
  26. Console.WriteLine("Wynik tego mnoĆŒenia to: " + (a * b));
  27. break;
  28. case "/":
  29. Console.WriteLine("Wynik tego dzielenia to: " + (a / b));
  30. break;
  31.  
  32. Deafult:
  33. Console.WriteLine("Niepoprawne dziaƂanie");
  34. Console.ReadLine();
  35.  
  36.  
  37. }
  38. }
  39. else
  40. Console.WriteLine("Niepoprawne dane");
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement