Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function bonusPoints(input){
- let n = parseInt(input[0]);
- let bonus = 0.0;
- if (n <= 100){
- bonus = 5;
- }
- else if ( n > 100 && n < 1000){
- bonus = (n * 20) / 100;
- }
- else{
- bonus = n * 0.10;
- }
- if ( n % 2 === 0){
- bonus = bonus + 1;
- }
- if(n % 10 === 5){
- bonus = bonus + 2;
- }
- console.log(`${bonus}`);
- console.log(`${n + bonus}`);
- }
Add Comment
Please, Sign In to add comment