Guest User

Delenie

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