Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace _14_exam2_DivisionWithoutResidue
- {
- class Program
- {
- static void Main(string[] args)
- {
- int n = int.Parse(Console.ReadLine());
- double count1 = 0.0;
- double count2 = 0.0;
- double count3 = 0.0;
- for (int i = 0; i < n; i++)
- {
- int num = int.Parse(Console.ReadLine());
- if (num % 2 == 0)
- {
- count1++;
- }
- if (num % 3 == 0)
- {
- count2++;
- }
- if (num % 4 == 0)
- {
- count3++;
- }
- }
- double p1 = (count1 / n) * 100.0;
- double p2 = (count2 / n) * 100.0;
- double p3 = (count3 / n) * 100.0;
- Console.WriteLine($"{p1:f2}%");
- Console.WriteLine($"{p2:f2}%");
- Console.WriteLine($"{p3:f2}%");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment