Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function bonusScore(input) {
- let number = Number(input);
- let bonus = 0.0;
- if (number <= 100) {
- bonus = 5;
- } else if (number > 1000) {
- bonus = number * 0.1;
- } else {
- bonus = number * 0.2;
- }
- if (number % 2 === 0) {
- bonus = bonus + 1;
- } else if (number % 10 === 5) {
- bonus = bonus + 2;
- }
- console.log(bonus);
- console.log(number + bonus);
- }
- Taрикатско решение:
- function bonusScore(input) {
- let number = Number(input);
- let bonus = 5.0;
- if (number > 1000) {
- bonus = number * 0.1;
- } else if (number > 100) {
- bonus = number * 0.2;
- }
- if (number % 2 === 0) {
- bonus = bonus + 1;
- } else if (number % 10 === 5) {
- bonus = bonus + 2;
- }
- console.log(`${bonus}\n${number + bonus}`);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement