Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function solve(arr) {
- var points = Number(arr[0]);
- var bonusPoints = 0;
- var allPoints = 0;
- if (points <= 100) {
- bonusPoints = 5;
- allPoints = points + bonusPoints;
- }
- else if (points > 100 && points <= 1000) {
- bonusPoints = points * 20 / 100;
- allPoints = points + bonusPoints;
- }
- else if (points > 1000) {
- bonusPoints = points * 10 / 100;
- allPoints = points + bonusPoints;
- }
- if (points % 2 == 0) {
- bonusPoints++;
- allPoints++;
- }
- if (points % 10 == 5) {
- bonusPoints = bonusPoints + 2;
- allPoints = allPoints + 2;
- }
- console.log(bonusPoints);
- console.log(allPoints);
- }
Advertisement
Add Comment
Please, Sign In to add comment