Guest User

Division

a guest
Oct 9th, 2016
256
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. using System;
  2.  
  3. class Division
  4. {
  5. static void Main()
  6. {
  7. int n = int.Parse(Console.ReadLine());
  8. double p1 = 0.0;
  9. double p2 = 0.0;
  10. double p3 = 0.0;
  11.  
  12. for (int i = 0; i < n; i++)
  13. {
  14. int num = int.Parse(Console.ReadLine());
  15.  
  16. if (num % 2 == 0)
  17. {
  18. p1++;
  19. }
  20. if (num % 3 == 0)
  21. {
  22. p2++;
  23. }
  24. if (num % 4 == 0)
  25. {
  26. p3++;
  27. }
  28.  
  29. }
  30.  
  31. Console.WriteLine("{0:f2}%", (p1 / n * 100));
  32. Console.WriteLine("{0:f2}%", (p2 / n * 100));
  33. Console.WriteLine("{0:f2}%", (p3 / n * 100));
  34. }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment