Problem: Division without Remainder

We have n integers in the range [1 ... 1000]. From them, some percent p1 are divisible without remainder by 2, percent p2 are divisible withour remainder by 3, percent p3 are divisible without remainder by 4. Write a program that calculates and prints the p1, p2 and p3 percents. Example: We have n = 10 numbers: 680, 2, 600, 200, 800, 799, 199, 46, 128, 65. We get the following distribution and visualization:

Division without remainder by: Numbers Count Percent
2 680, 2, 600, 200, 800, 46, 128 7 p1 = (7 / 10) * 100 = 70.00%
3 600 1 p2 = (1 / 10) * 100 = 10.00%
4 680, 600, 200, 800, 128 5 p3 = (5 / 10) * 100 = 50.00%

Input Data

On the first line of the input is the integer n (1 ≤ n ≤ 1000) - count of numbers. In the next n lines stands one integer in the range [1 … 1000] – numbers, that needs to be checked for division.

Output Data

Print on the console 3 lines, each of them containing a percent between 0% and 100%, two places after the decimal point, for example 25.00%, 66.67%, 57.14%.

  • On the first line – percent of the numbers, that are divisible by 2.
  • On the second line – percent of the numbers, that are divisible by 3.
  • On the third line – percent of the numbers, that are divisible by 4.

Sample Input and Output

Input Output Input Output Input Output
10
680
2
600
200
800
799
199
46
128
65
70.00%
10.00%
50.00%
3
3
6
9
33.33%
100.00%
0.00%
1
12
100.00%
100.00%
100.00%

results matching ""

    No results matching ""