Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class DivideWithiot {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int NumberOfLoops = Integer.parseInt(scanner.nextLine());
- double Divide2 = 0.0;
- double Divide3 = 0.0;
- double Divide4 = 0.0;
- for (int Index = 0; Index < NumberOfLoops; Index++)
- {
- int Number = Integer.parseInt(scanner.nextLine());
- if (Number % 2 == 0)
- {
- Divide2++;
- }
- if (Number % 3 == 0)
- {
- Divide3++;
- }
- if (Number % 4 == 0)
- {
- Divide4++;
- }
- }
- double PercentOf2 = (Divide2 * 100) / NumberOfLoops;
- double PercentOf3 = (Divide3 * 100) / NumberOfLoops;
- double PercentOf4 = (Divide4 * 100) / NumberOfLoops;
- System.out.printf("%.2f%%%n", PercentOf2);
- System.out.printf("%.2f%%%n", PercentOf3);
- System.out.printf("%.2f%%%n", PercentOf4);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement