desislava_topuzakova

02. Bonus Score

Apr 26th, 2020
546
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.28 KB | None | 0 0
  1. using System;
  2.  
  3. namespace demo
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             //1. прочитаме числото
  10.             //2. бонус = 0
  11.             //3. проверка за големината на числото и получаване на бонус
  12.             //4. получаване на допълнителен бонус
  13.             //5. принтираме
  14.             int number = int.Parse(Console.ReadLine());
  15.             double bonus = 0;
  16.  
  17.             //бонус 1
  18.             if (number <= 100)
  19.             {
  20.                 bonus = 5;
  21.             }
  22.             else if (number > 1000)
  23.             {
  24.                 bonus = 0.1 * number;
  25.             }
  26.             else if (number > 100)
  27.             {
  28.                 bonus = 0.2 * number;
  29.             }
  30.            
  31.  
  32.             //бонус 2
  33.             //четно
  34.             //завършва на 5
  35.  
  36.             if (number % 2 == 0)
  37.             {
  38.                 //even
  39.                 bonus = bonus + 1;
  40.             }
  41.             else if (number % 10 == 5)
  42.             {
  43.                 bonus = bonus + 2;
  44.             }
  45.  
  46.             Console.WriteLine(bonus);
  47.             Console.WriteLine(number + bonus);
  48.  
  49.  
  50.  
  51.  
  52.         }
  53.     }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment