Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace _05.DivisionWithoutRemainder
- {
- class DivisionWithoutRemainder
- {
- static void Main(string[] args)
- {
- double n = int.Parse(Console.ReadLine());
- double counter2 = 0;
- double counter3 = 0;
- double counter4 = 0;
- for (int i = 1; i <= n; i++)
- {
- double num = int.Parse(Console.ReadLine());
- if (num % 2 == 0)
- {
- counter2++;
- }
- if (num % 3 == 0)
- {
- counter3++;
- }
- if (num % 4 == 0)
- {
- counter4++;
- }
- }
- double p1 = (counter2 / n) * 100;
- double p2 = (counter3 / n) * 100;
- double p3 = (counter4 / n) * 100;
- Console.WriteLine($"{p1:F2}%");
- Console.WriteLine($"{p2:F2}%");
- Console.WriteLine($"{p3:F2}%");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement