Advertisement
nevenailievaa

02.BonusScore

Nov 10th, 2024
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.57 KB | None | 0 0
  1. //Input
  2. int number = int.Parse(Console.ReadLine());
  3.  
  4. //Calculations
  5. double bonusPoints = 0;
  6.  
  7. if (number <= 100)
  8. {
  9.     bonusPoints = 5;
  10. }
  11. else if (number <= 1000)
  12. {
  13.     bonusPoints = number * 0.2;
  14. }
  15. else if (number > 1000)
  16. {
  17.     bonusPoints = number * 0.1;
  18. }
  19.  
  20. double additionalBonusPoints = 0;
  21.  
  22. if (number % 2 == 0)
  23. {
  24.     additionalBonusPoints = 1;
  25. }
  26. else if (number % 10 == 5)
  27. {
  28.     additionalBonusPoints = 2;
  29. }
  30.  
  31. //Output
  32. double pointsSum = bonusPoints + additionalBonusPoints;
  33.  
  34. Console.WriteLine(pointsSum);
  35. Console.WriteLine(number + pointsSum);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement