Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function divideWithoutRemainder(input) {
- let n = parseInt(input[0]),
- number, p1 = 0, p2 = 0, p3 = 0;
- for (let i = 1; i <= n; i++) {
- number = Number(input[i]);
- if (number % 2 === 0) {
- p1++;
- }
- if (number % 3 === 0) {
- p2++;
- }
- if (number % 4 === 0) {
- p3++;
- }
- }
- console.log(`${(p1 / n * 100).toFixed(2)}%`);
- console.log(`${(p2 / n * 100).toFixed(2)}%`);
- console.log(`${(p3 / n * 100).toFixed(2)}%`);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement