Advertisement
Guest User

Untitled

a guest
Oct 31st, 2014
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 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 Zadanie1b
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. try
  14. {
  15. Int64 liczba = 0, suma = 0, średnia = 0;
  16. Random r = new Random();
  17. for (int i = 1; i < 11; i++)
  18. {
  19. liczba = r.Next(10, 20);
  20. for (; liczba % 2 == 0; )
  21. {
  22. liczba = r.Next(10, 20);
  23. }
  24.  
  25. suma += liczba;
  26. średnia = suma / i;
  27. Console.WriteLine("Krok pętli nr {0}, podano liczbę {1}, suma {2}, średnia {3}", i, liczba, suma, średnia);
  28. }
  29. }
  30. catch (Exception q)
  31. {
  32.  
  33. Console.WriteLine(q.Message);
  34. }
  35.  
  36. Console.ReadKey();
  37. }
  38. }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement