Advertisement
KrasenPenev

Divide Without Remainder

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