Advertisement
kuruku

BonusScore

Apr 19th, 2014
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.98 KB | None | 0 0
  1. using System;
  2.  
  3. //Write a program that applies bonus score to given score in the range [1…9] by the following rules:
  4. //•   If the score is between 1 and 3, the program multiplies it by 10.
  5. //•   If the score is between 4 and 6, the program multiplies it by 100.
  6. //•   If the score is between 7 and 9, the program multiplies it by 1000.
  7. //•   If the score is 0 or more than 9, the program prints “invalid score”.
  8.  
  9. class BonusScore
  10. {
  11.     static void Main()
  12.     {
  13.         Console.Write("Number = ");
  14.         int number = int.Parse(Console.ReadLine());
  15.  
  16.         if (number >= 1 && number <= 3)
  17.         {
  18.             Console.WriteLine(number * 10);
  19.         }
  20.         else if (number >= 4 && number <= 6)
  21.         {
  22.             Console.WriteLine(number * 100);
  23.  
  24.         }
  25.         else if (number >= 7 && number <= 9)
  26.         {
  27.             Console.WriteLine(number * 1000);
  28.         }
  29.         else
  30.         {
  31.             Console.WriteLine("invalid score");
  32.         }
  33.     }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement