Advertisement
naskodaskalov

Untitled

Apr 12th, 2016
290
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 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 Divicing
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. var n = int.Parse(Console.ReadLine());
  14. var p1 = 0.0;
  15. var p2 = 0.0;
  16. var p3 = 0.0;
  17.  
  18. for (int i = 0; i < n; i++)
  19. {
  20. var num = int.Parse(Console.ReadLine());
  21.  
  22. if (num % 2 == 0)
  23. {
  24. p1++;
  25. }
  26. if (num % 3 == 0)
  27. {
  28. p2++;
  29. }
  30. if (num % 4 == 0)
  31. {
  32. p3++;
  33. }
  34. }
  35. Console.WriteLine("{0, 0:F2}%", (p1 / n) * 100);
  36. Console.WriteLine("{0, 0:F2}%", (p2 / n) * 100);
  37. Console.WriteLine("{0, 0:F2}%", (p3 / n) * 100);
  38. }
  39. }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement