Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function spaceShip(input) {
- let s = Number(input[0]);
- let d = Number(input[1]);
- let v = Number(input[2]);
- let sv = Number(input[3]);
- let ship = s * d * v;
- let astronaut = (sv + 0.4) * 2 * 2;
- let team = Math.floor(ship / astronaut);
- if (team < 3){
- console.log("The spacecraft is too small.");
- } else if (team > 10){
- console.log("The spacecraft is too big.")
- } else {
- console.log(`The spacecraft holds ${team} astronauts.`);
- }
- }
- Тарикатско решение:)
- function spaceShip(input) {
- let team = Math.floor((Number(input[0]) * Number(input[1]) * Number(input[2])) /((Number(input[3]) + 0.4) * 2 * 2));
- console.log(team < 3 ? "The spacecraft is too small." : team > 10 ? "The spacecraft is too big." : `The spacecraft holds ${team} astronauts.`);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement