Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function solve(input) {
- let n = Number(input[0]);
- kol = 0;
- gr = 0;
- allKol = 0;
- gradus = 0;
- allGr = 0;
- totalGr = 0;
- for (let i = 1; i <= n; i++) {
- kol = Number(input.shift());
- gr = Number(input.shift());
- gradus = kol * gr;
- allKol += kol;
- allGr += gradus;
- }
- totalGr = allGr / allKol;
- console.log(`Liter: ${allKol.toFixed(2)}`);
- console.log(`Degrees: ${totalGr.toFixed(2)}`);
- if (totalGr < 38) {
- console.log("Not good, you should baking!");
- } else if (totalGr >= 38 && totalGr <= 42) {
- console.log("Super!");
- } else if (totalGr > 42) {
- console.log("Dilution with distilled water!");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement