Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace ConsoleApp1
- {
- class Program
- {
- static void Main(string[] args, int num6)
- {
- Console.WriteLine("Welcome!");
- Console.WriteLine("You are asked to answer two questions correctly");
- int maxAttempts = 3;
- bool IsRightAnswer = false;
- int attCount = 0;
- Console.WriteLine("You will be given {0} Attempts for each question", maxAttempts);
- while (attCount < maxAttempts && !IsRightAnswer)
- {
- int num1 = 5;
- int num2 = 33;
- Console.WriteLine("How much is {0} + {1} ?", num1, num2);
- string answer = Console.ReadLine();
- IsRightAnswer = (num1 + num2 == int.Parse(answer));
- if (IsRightAnswer)
- {
- Console.WriteLine("Correct! Moving to the next question");
- }
- else
- {
- Console.WriteLine("WRONG! You have {0} attempts left", attCount);
- attCount++;
- }
- while (attCount < maxAttempts && !IsRightAnswer)
- {
- int num3 = 10;
- int num4 = 35;
- Console.WriteLine("How much is {0} - {1} ?", num4, num3);
- string answer2 = Console.ReadLine();
- IsRightAnswer = (num4 - num3 == int.Parse(answer2));
- if (IsRightAnswer)
- {
- Console.WriteLine("Congratulations! You beat the game!");
- }
- else
- {
- Console.WriteLine("Wrong! You have {0} Attemps left", attCount);
- attCount++;
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement