popovIliya

March-2022-Conditional Statements - Exercise -Bonus Score

Mar 13th, 2022 (edited)
313
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function bonusPoints(input){
  2. let n = parseInt(input[0]);
  3. let bonus = 0.0;
  4. if (n <= 100){
  5.     bonus = 5;
  6.    }
  7.    else if ( n > 100 && n < 1000){
  8.     bonus = (n * 20) / 100;
  9.    }
  10.    else{
  11.        bonus = n * 0.10;
  12. }
  13. if ( n % 2 === 0){
  14.  bonus = bonus + 1;
  15. }
  16. if(n % 10 === 5){
  17.     bonus = bonus + 2;
  18. }
  19. console.log(`${bonus}`);
  20. console.log(`${n + bonus}`);
  21. }
Add Comment
Please, Sign In to add comment