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 DivisionWithoutRemainder
- {
- class Program
- {
- static void Main(string[] args)
- {
- var n = int.Parse(Console.ReadLine());
- double myCount = 0;
- int countP1 = 0;
- int countP2 = 0;
- int countP3 = 0;
- double p1 = 0.0;
- double p2 = 0.0;
- double p3 = 0.0;
- for(var i = 0; i <= n - 1; i++)
- {
- var number=int.Parse(Console.ReadLine());
- myCount++;
- if (number % 2 == 0)
- {
- countP1++;
- }
- if (number % 3 == 0)
- {
- countP2++;
- }
- if (number % 4 == 0)
- {
- countP3++;
- }
- }//end of for
- p1 = countP1/myCount*100;
- p2 = countP2/myCount*100;
- p3 = countP3/myCount*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