Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Project: Exam_26_March_2016 - created by borkins on 2017-05-14.
- */
- import java.util.Scanner;
- public class _04_DivisionWithoutRemainder
- {
- public static void main(String[] args)
- {
- Scanner console = new Scanner(System.in);
- int n = Integer.parseInt(console.nextLine());
- int[] p = new int[3];
- for (int i = 0; i < n; i++)
- {
- int num = Integer.parseInt(console.nextLine());
- if (num % 2 == 0) p[0]++;
- if (num % 3 == 0) p[1]++;
- if (num % 4 == 0) p[2]++;
- }
- for (int i = 0; i < p.length; i++)
- {
- System.out.printf("%.2f%%%n", (p[i] / (double) n * 100));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment