Advertisement
svetoslavbozov

[C#-1.5.10] BonusPoints

Dec 30th, 2012
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.16 KB | None | 0 0
  1. /*  Write a program that applies bonus scores to given scores in the range [1..9]. The program reads a digit as an input. If the digit is between 1 and 3, the program multiplies it by 10; if it is between 4 and 6, multiplies it by 100; if it is between 7 and 9, multiplies it by 1000. If it is zero or if the value is not a digit, the program must report an error.
  2. */
  3. using System;
  4.  
  5. class BonusPoints
  6. {
  7.     static void Main()
  8.     {
  9.         int points = int.Parse(Console.ReadLine());
  10.        
  11.         switch (points)
  12.         {
  13.             case 1:              
  14.             case 2:                
  15.             case 3:
  16.                 points *= 10;
  17.                 Console.WriteLine(points);
  18.                 break;
  19.             case 4:
  20.             case 5:
  21.             case 6:
  22.                 points *= 100;
  23.                 Console.WriteLine(points);
  24.                 break;
  25.             case 7:
  26.             case 8:
  27.             case 9:
  28.                 points *= 1000;
  29.                 Console.WriteLine(points);
  30.                 break;
  31.  
  32.             default:
  33.                 Console.WriteLine("Invalid value.");
  34.                 break;
  35.         }
  36.        
  37.     }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement