Advertisement
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 deviding
- {
- class deviding
- {
- static void Main(string[] args)
- {
- int n = int.Parse(Console.ReadLine());
- double sum2 = 0;
- double sum3 = 0;
- double sum4 = 0;
- for (int i = 1; i <= n; i++)
- {
- int num = int.Parse(Console.ReadLine());
- if (num%2==0)
- {
- sum2 += 1;
- }
- if (num%3==0)
- {
- sum3 += 1;
- }
- if (num%4==0)
- {
- sum4 += 1;
- }
- }
- double p1 = sum2 / n * 100;
- double p2 = sum3 / n * 100;
- double p3 = sum4 / n * 100;
- Console.WriteLine("{0:F2}%", p1);
- Console.WriteLine("{0:F2}%", p2);
- Console.WriteLine("{0:F2}%", p3);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement