Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace exampreparation
- {
- class exam
- {
- static void Main(string[] args)
- {
- int points = int.Parse(Console.ReadLine());
- int count = 0;
- while (points > 0)
- {
- string hit = Console.ReadLine();
- count++;
- if (hit == "bullseye")
- {
- Console.WriteLine($"Congratulations! You won the game with a bullseye in {count} moves!");
- break;
- }
- int hitPoints = int.Parse(Console.ReadLine());
- if (hit == "number section")
- {
- points -= hitPoints;
- }
- else if (hit == "double ring")
- {
- points -= hitPoints * 2;
- }
- else if (hit == "triple ring")
- {
- points -= hitPoints * 3;
- }
- if (points < 0)
- {
- Console.WriteLine($"Sorry, you lost. Score difference: {Math.Abs(points)}.");
- break;
- }
- }
- if (points == 0)
- {
- Console.WriteLine($"Congratulations! You won the game in {count} moves!");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement