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