Advertisement
NedyalkoKikov

ElemtsInArr

May 5th, 2016
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Arr
  8. {
  9. class ElemtsInArr
  10. {
  11. static void Main()
  12. {
  13. int[] simpleArray = { 1, 2, 3, 4, 5, 6 };
  14. int[] elementsByTwo = { 1, 2, 3, 4, 5, 6, 7 };
  15.  
  16. ElementsInArray(simpleArray);
  17. Console.WriteLine();
  18. ElementsInArrayIncrementedByTwo(elementsByTwo);
  19. }
  20. public static int[] ElementsInArray(int[] simpleArray)
  21. {
  22. for (int i = 0; i < simpleArray.Length; i++)
  23. {
  24. int elements = simpleArray[i] + 1;
  25. Console.Write(elements + ", ");
  26. }
  27. return simpleArray;
  28. }
  29. public static int[] ElementsInArrayIncrementedByTwo(int[] elementsByTwo)
  30. {
  31. for (int i = 0; i < elementsByTwo.Length; i++)
  32. {
  33. int elements = elementsByTwo[i] * 2;
  34. Console.Write(elements + ", ");
  35. }
  36. return elementsByTwo;
  37. }
  38.  
  39.  
  40. }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement