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