fork download
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace ConsoleApplication4
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. int[] test = new int[5];
  14. test[0] = 1;
  15. test[1] = 2;
  16. test[2] = 3;
  17. test[3] = 4;
  18. test[4] = 5;
  19. Console.WriteLine("Test before method:");
  20. foreach (var item in test)
  21. {
  22. Console.WriteLine(item.ToString());
  23. }
  24. Console.WriteLine("\r\nTest after method:");
  25. test = mnozenie(test, 2);
  26. foreach (var item in test)
  27. {
  28. Console.WriteLine(item.ToString());
  29. }
  30. Console.ReadLine();
  31. }
  32.  
  33. public static int[] mnozenie(int[] tab, int mnoznik)
  34. {
  35. if (tab.Length > 0)
  36. {
  37. for (int i = 0; i < tab.Length; i++)
  38. {
  39. tab[i] *= mnoznik;
  40. }
  41.  
  42. return tab;
  43. }
  44. return null;
  45. }
  46. }
  47. }
Success #stdin #stdout 0.03s 24160KB
stdin
Standard input is empty
stdout
Test before method:
1
2
3
4
5

Test after method:
2
4
6
8
10