kirililchev3

Bonus Score - if-else

May 18th, 2018
249
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.78 KB | None | 0 0
  1. using System;
  2.  
  3. namespace ConsoleApp1
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int num = int.Parse(Console.ReadLine());
  10.             double bonusScore = 0.0;
  11.  
  12.             if (num > 1000)
  13.             {
  14.                 bonusScore = num * 0.10;
  15.             } else if (num>100 && num<=1000)
  16.             {
  17.                 bonusScore = num * 0.20;
  18.             } else if (num<=100)
  19.             {
  20.                 bonusScore = 5;
  21.             }
  22.             if (num % 10 ==5)
  23.             {
  24.                 bonusScore += 2;
  25.             } else if (num % 2 == 0)
  26.             {
  27.                 bonusScore += 1;
  28.             }
  29.             Console.WriteLine(bonusScore);
  30.             Console.WriteLine(num + bonusScore);
  31.         }
  32.     }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment