Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function solve(input) {
- let chislo = Number(input[0]);
- let input1 = input[1];
- let output = input[2];
- let final = 0;
- if (input1 === 'mm' && output === 'm') {
- final = chislo / 1000;
- console.log(final.toFixed(3));
- } else if (input1 === 'm' && output === 'cm') {
- final = chislo * 100;
- console.log(final.toFixed(3));
- } else if ( input1 === 'cm' && output === 'mm') {
- final = chislo * 10;
- console.log(final.toFixed(3));
- } else if (input1 === 'mm' && output === 'cm') {
- final = chislo / 10;
- console.log(final.toFixed(3));
- } else if (input1 === 'cm' && output === 'm') {
- final = chislo / 100;
- console.log(final.toFixed(3));
- } else if (input1 === 'm' && output === 'mm') {
- final = chislo * 1000;
- console.log(final.toFixed(3));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement