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