Advertisement
plamen27

Fixed

Jun 30th, 2016
1,531
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 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 count = int.Parse(Console.ReadLine());
  14. var p2 = 0.0;
  15. var p3 = 0.0;
  16. var p4 = 0.0;
  17.  
  18.  
  19. for (int i = 0; i < count; i++)
  20. {
  21. var number = int.Parse(Console.ReadLine());
  22.  
  23. if (number % 2 == 0)
  24. {
  25. p2++;
  26. }
  27. if (number % 3 == 0)
  28. {
  29. p3++;
  30. }
  31. if (number % 4 == 0)
  32. {
  33. p4++;
  34. }
  35. }
  36.  
  37. Console.WriteLine("{0, 0:F2}%", p2 /count * 100);
  38. Console.WriteLine("{0, 0:F2}%", p3 /count * 100);
  39. Console.WriteLine("{0,0:F2}%", p4 /count * 100);
  40. }
  41. }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement