Advertisement
Dianov

Conditional Statements - Exercise (02. Bonus Score)

Oct 16th, 2020
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.12 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace BonusScore
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int startingNumber = int.Parse(Console.ReadLine()); // начално число
  14.             double bonusPoints; // бонус точки
  15.             if (startingNumber <= 100)
  16.             {
  17.                 bonusPoints = 5;
  18.                 if (startingNumber % 2 == 0)
  19.                 {
  20.                     bonusPoints = bonusPoints + 1;
  21.                 }
  22.                 if (startingNumber % 5 == 0 && startingNumber % 10 != 0)
  23.                 {
  24.                     bonusPoints = bonusPoints + 2;
  25.                 }
  26.                 double finalPoints = startingNumber + bonusPoints;
  27.                 Console.WriteLine(bonusPoints);
  28.                 Console.WriteLine(finalPoints);
  29.             }
  30.             if (startingNumber > 100 && startingNumber < 1000)
  31.             {
  32.                 bonusPoints = startingNumber * 0.2;
  33.                 if (startingNumber % 2 == 0)
  34.                 {
  35.                     bonusPoints = bonusPoints + 1;
  36.                 }
  37.                 if (startingNumber % 5 == 0 && startingNumber % 10 != 0)
  38.                 {
  39.                     bonusPoints = bonusPoints + 2;
  40.                 }
  41.                 double finalPoints = startingNumber + bonusPoints;
  42.                 Console.WriteLine(bonusPoints);
  43.                 Console.WriteLine(finalPoints);
  44.             }
  45.             if (startingNumber > 1000)
  46.             {
  47.                 bonusPoints = startingNumber * 0.10;
  48.                 if (startingNumber % 2 == 0)
  49.                 {
  50.                     bonusPoints = bonusPoints + 1;
  51.                 }
  52.                 if (startingNumber % 5 == 0 && startingNumber % 10 != 0)
  53.                 {
  54.                     bonusPoints = bonusPoints + 2;
  55.                 }
  56.                 double finalPoints = startingNumber + bonusPoints;
  57.                 Console.WriteLine(bonusPoints);
  58.                 Console.WriteLine(finalPoints);
  59.             }
  60.         }
  61.     }
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement