Advertisement
ajreuri23

שאלה 18

Dec 3rd, 2016
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. static void Main(string[] args)
  2. {
  3. int[] action = new int[18];
  4. int[] result = new int[6];
  5. int i, j, f, x;
  6. for (i = 0; i < action.Length; i++)
  7. {
  8. action[i] = int.Parse(Console.ReadLine());
  9. }
  10. for (j = 0; j < action.Length; j++)
  11. {
  12. if (j % 3 == 0)
  13. {
  14. if (action[j] == 1)
  15. {
  16. result[j / 3] = action[j + 1] + action[j + 2];
  17. }
  18. else if (action[j] == 2)
  19. {
  20. result[j / 3] = action[j + 1] - action[j + 2];
  21. }
  22. }
  23. }
  24. Console.WriteLine("");
  25. for (x = 0; x < action.Length; x++)
  26. {
  27. Console.Write(action[x] + " ");
  28. }
  29. Console.WriteLine("");
  30. for (f = 0; f < result.Length; f++)
  31. {
  32. Console.Write(result[f] + " ");
  33. }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement