Advertisement
Guest User

Applied Arithmetics

a guest
Apr 21st, 2018
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3.  
  4. public class Program
  5. {
  6. public static void Main()
  7. {
  8. string[] numbers = Console.ReadLine().Split(' ');
  9. string b;
  10. do
  11. {
  12. b = Console.ReadLine();
  13. {
  14. for (int i = 0; i < numbers.Length; i++)
  15. {
  16. int c = Convert.ToInt32(numbers[i]);
  17. {
  18. if (b == "add")
  19. {
  20. c++;
  21. }
  22. else if (b == "multiply")
  23. {
  24. c *= 2;
  25. }
  26. else if (b == "subtract")
  27. {
  28. c--;
  29. }
  30. }
  31. }
  32. }
  33. }while(b != "end");
  34. {
  35. foreach(var c in numbers)
  36. {
  37. Console.Write("{0} ", c);
  38. }
  39. }
  40. }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement