IvetValcheva

Bonus Score

Apr 12th, 2021
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.27 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Ex._2
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.  
  10.             int n = int.Parse(Console.ReadLine());
  11.             double bonus = 0;
  12.  
  13.             if (n<100)
  14.             {
  15.                 // bonus+=5;
  16.                 bonus = bonus + 5;
  17.             }
  18.             else if (n > 1000)
  19.             {
  20.                 //kod za izpylnenie pri n po-golqmo ot 1000
  21.                 bonus = bonus + n * 10.0 / 100;
  22.             }
  23.             else
  24.             {
  25.                 //kod za izpylnenie pri n>=100 i n<=1000
  26.                 bonus = bonus + n * 20.0 / 100;
  27.             }
  28.  
  29.             //Вариант 1:
  30.             bool even = n % 2 == 0;
  31.             if (even)
  32.             {
  33.                 //bonus+=1;
  34.                 bonus = bonus + 1;
  35.             }
  36.             int m = n % 10;
  37.             if (m == 5)
  38.             {
  39.                 //bonus+=2;
  40.                 bonus = bonus + 2;
  41.             }
  42.  
  43.             //Вариант 2:
  44.             //if (n % 2 == 0)
  45.             //{
  46.             //    bonus += 1;
  47.             //}
  48.             //else if (n % 10 == 5)
  49.             //{
  50.             //    bonus += 2;
  51.             //}
  52.  
  53.             Console.WriteLine(bonus);
  54.             Console.WriteLine(n + bonus);
  55.         }
  56.     }
  57. }
  58.  
Advertisement
Add Comment
Please, Sign In to add comment