Advertisement
Guest User

Untitled

a guest
Nov 18th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. using System;
  2.  
  3. public class Program
  4. {
  5. public static void Main()
  6. {
  7. String unos = "";
  8. int brojac = 0;
  9. int zbir = 0;
  10. int broj;
  11.  
  12.  
  13. while(unos != "1000")
  14. {
  15. unos = Console.ReadLine();
  16.  
  17. try
  18. {
  19. broj = Int32.Parse(unos);
  20.  
  21. if(broj != 1000 && broj % 2 == 0)
  22. {
  23. brojac++;
  24. zbir = zbir + broj;
  25. }
  26. }
  27. catch(Exception e){
  28.  
  29. }
  30.  
  31.  
  32. }
  33.  
  34. Console.WriteLine(zbir / brojac);
  35. }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement