Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Problem 2. Bonus Score
- //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 BonusScore
- {
- static void Main()
- {
- Console.Write("Please,enter score:");
- int score = int.Parse(Console.ReadLine());
- int bonusScore;
- if (score >= 1 && score <= 3)
- {
- bonusScore = score * 10;
- Console.WriteLine("The score is {0} and the bonus score is {1}", score, bonusScore);
- }
- else if (score >= 4 && score <= 6)
- {
- bonusScore = score * 100;
- Console.WriteLine("The score is {0} and the bonus score is {1}", score, bonusScore);
- }
- else if (score >= 7 && score <= 9)
- {
- bonusScore=score*1000;
- Console.WriteLine("The score is {0} and the bonus score is {1}", score, bonusScore);
- }
- else
- {
- Console.WriteLine("The score {0} is Invalid score.",score);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement