Advertisement
YavorJS

Bonus Points C#

May 30th, 2016
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. using System;
  2.  
  3.  
  4.  
  5. class Program
  6. {
  7. static void Main()
  8. {
  9.  
  10. int n = int.Parse(Console.ReadLine());
  11. double bonusPoints = 0.0;
  12. double totalPoints = 0.0;
  13.  
  14. if (n <= 100)
  15. {
  16. bonusPoints = 5;
  17. }
  18. else if (n > 100 && n <= 1000)
  19. {
  20. bonusPoints = n * 20 / 100;
  21. }
  22. else if (n > 1000)
  23. {
  24. bonusPoints = n * 10 / 100;
  25. }
  26.  
  27. if (n % 2 == 0)
  28. {
  29. bonusPoints += 1;
  30. }
  31. else if (n % 10 == 5)
  32. {
  33. bonusPoints += 2;
  34. }
  35.  
  36. totalPoints = n + bonusPoints;
  37.  
  38. Console.WriteLine(bonusPoints);
  39. Console.WriteLine(totalPoints);
  40.  
  41. }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement