desislava_topuzakova

02. Бонус точки

Nov 21st, 2021
1,209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.03 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _02._Bonus_Points
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int points = int.Parse(Console.ReadLine());
  10.             double bonus = 0; //бонус точки
  11.  
  12.             //стойността на числото
  13.             if (points <= 100)
  14.             {
  15.                 bonus = 5;
  16.             }
  17.             else if (points > 100 && points <= 1000)
  18.             {
  19.                 bonus = 0.2 * points;
  20.             }
  21.             else if (points > 1000)
  22.             {
  23.                 bonus = 0.1 * points;
  24.             }
  25.  
  26.             //четно или завършва на 5
  27.             if (points % 2 == 0)
  28.             {
  29.                 bonus = bonus + 1;
  30.                 //bonus += 1;
  31.             }
  32.             else if (points % 10 == 5)
  33.             {
  34.                 bonus = bonus + 2;
  35.                 //bonus += 2;
  36.             }
  37.  
  38.             Console.WriteLine(bonus);
  39.             Console.WriteLine(points + bonus);
  40.         }
  41.     }
  42. }
  43.  
Advertisement
Add Comment
Please, Sign In to add comment