Advertisement
Guest User

Untitled

a guest
Nov 24th, 2014
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 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 CnslTablica1
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. Console.WriteLine("TABLICA 1-WYMIAROWA");
  14. //Deklaracja tablicy
  15. int[] tab = new int[10];
  16. Random r = new Random();
  17. //Wypełniamy tablicę losowych wart. od 0 do 20
  18. for (int i = 0; i < tab.Length; i++)
  19. tab[i] = r.Next(21);
  20.  
  21. WypiszTab(tab, "Elementy tablicy:");
  22.  
  23. Console.ReadLine();
  24. }
  25. static void WypiszTab(int[] tab, string opis)
  26. {
  27. Console.WriteLine();
  28. Console.WriteLine(opis);
  29. foreach (int elem in tab)
  30. Console.Write(elem + "\t");
  31. }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement