Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function footballLeague(input) {
- let stadiumCapacity = parseInt(input[0]);
- let footballFens = parseInt(input[1]);
- let sectorA = 0;
- let sectorB = 0;
- let sectorV = 0;
- let sectorG = 0;
- for (let i = 2; i <= footballFens + 1; i++){
- if (input[i] === "A"){
- sectorA++;
- } else if (input[i] === "B"){
- sectorB++;
- } else if (input[i] === "V"){
- sectorV++;
- } else if (input[i] === "G"){
- sectorG++;
- }
- }
- console.log(`${(sectorA / footballFens * 100).toFixed(2)}%`);
- console.log(`${(sectorB / footballFens * 100).toFixed(2)}%`);
- console.log(`${(sectorV / footballFens * 100).toFixed(2)}%`);
- console.log(`${(sectorG / footballFens * 100).toFixed(2)}%`);
- console.log(`${(footballFens / stadiumCapacity * 100).toFixed(2)}%`);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement