Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Problem 2. Bonus Score ... Variant with case
- //Write a program that applies bonus score to given score in the range [1…9] by the following rules:
- //• If the score is between 1 and 3, the program multiplies it by 10.
- //• If the score is between 4 and 6, the program multiplies it by 100.
- //• If the score is between 7 and 9, the program multiplies it by 1000.
- //• If the score is 0 or more than 9, the program prints “invalid score”.
- using System;
- class BonusScoreVariant
- {
- static void Main()
- {
- Console.Write("Please, enter score from 1 to 9:");
- int score =int.Parse(Console.ReadLine());
- switch (score)
- {
- case 1:
- case 2:
- case 3:
- Console.WriteLine("The bonus is {0}",score*10);
- break;
- case 4:
- case 5:
- case 6:
- Console.WriteLine("The bonus is {0}",score*100);
- break;
- case 7:
- case 8:
- case 9:
- Console.WriteLine("The bonus is {0}",score*1000);
- break;
- default:
- Console.WriteLine("You enter wrong score.Please, try again");
- break;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement