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