Advertisement
Guest User

Untitled

a guest
Feb 19th, 2020
91
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.  
  6. namespace ConsoleApp1
  7. {
  8.  
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. Console.WriteLine("Podaj rozmiar: ");
  14. string liczba = Console.ReadLine();
  15.  
  16. int rozmiar = int.Parse(liczba);
  17.  
  18. int[] a = new int[10];
  19. for(int i=0;i<rozmiar;i++)
  20. {
  21. Console.WriteLine("Podaj liczbe: ");
  22. string numer = Console.ReadLine();
  23. int parsednumer = int.Parse(liczba);
  24. a[i] = parsednumer;
  25. }
  26. int sum = 0;
  27. for (int i = 0; i < a.Length; i++)
  28. {
  29. sum += a[i];
  30. }
  31. Console.WriteLine(sum);
  32.  
  33.  
  34. }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement