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 Division
- {
- class Division
- {
- static void Main(string[] args)
- {
- int n = int.Parse(Console.ReadLine());
- double Two = 0;
- double Three = 0;
- double Four = 0;
- double TwoPercent = 0;
- double ThreePercent = 0;
- double FourPercent = 0;
- bool a = (1 <= n) && (n <= 1000);
- for (int i = 1; i <= n; i++)
- {
- int number = int.Parse(Console.ReadLine());
- if ((number % 2 == 0) && a) Two++;
- if ((number % 3 == 0) && a) Three++;
- if ((number % 4 == 0) && a) Four++;
- if (Two != 0) TwoPercent = Two / n * 100;
- if (Three != 0) ThreePercent = Three / n * 100;
- if (Four != 0) FourPercent = Four / n * 100;
- }
- Console.WriteLine("{0:f2}" + "%", TwoPercent);
- Console.WriteLine("{0:f2}"+ "%", ThreePercent);
- Console.WriteLine("{0:f2}"+ "%", FourPercent);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement