anizko

06. Divide without remainder

Apr 10th, 2019
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.08 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Divide_without_remainder
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int countNum = int.Parse(Console.ReadLine());
  10.             double Counter2 = 0;
  11.             double Counter3 = 0;
  12.             double Counter4 = 0;
  13.  
  14.             for (int i = 1; i <= countNum; i++)
  15.             {
  16.                 double Num = double.Parse(Console.ReadLine());
  17.                 if(Num%2==0)
  18.                 {
  19.                     Counter2++;
  20.                 }
  21.                 if (Num % 3 == 0)
  22.                 {
  23.                     Counter3++;
  24.                 }
  25.                 if (Num % 4 == 0)
  26.                 {
  27.                     Counter4++;
  28.                 }
  29.             }
  30.             double Procent2 = Counter2 * 100 / countNum;
  31.             double Procent3 = Counter3 * 100 / countNum;
  32.             double Procent4 = Counter4 * 100 / countNum;
  33.  
  34.             Console.WriteLine($"{Procent2:f2}%");
  35.             Console.WriteLine($"{Procent3:f2}%");
  36.             Console.WriteLine($"{Procent4:f2}%");
  37.         }
  38.     }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment