Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int n = Integer.parseInt(scanner.nextLine()),
- number, p1 = 0, p2 = 0, p3 = 0;
- for (int i = 1; i <= n; i++) {
- number = Integer.parseInt(scanner.nextLine());
- if (number % 2 == 0) {
- p1++;
- }
- if (number % 3 == 0) {
- p2++;
- }
- if (number % 4 == 0) {
- p3++;
- }
- }
- System.out.printf("%.2f%%\n%.2f%%\n%.2f%%\n", 100.0 * p1 / n, 100.0 * p2 / n, 100.0 * p3 / n);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement