Hello, I’m working on this task:
Write a program that plays an ancient game - Zanzibar. The rules are very simple: you ask an opponent to choose a number with “Input a number”. When they answer with a number, you increment it by one and say “{my number}, I won!” Here’s what the console output should look like: Input a number
>100
101, I won!
/*Note: The > symbol, here and in future examples, indicates the user’s input.*/
Here is my code:
namespace ZanzibarGame
{
public class Zanzibar
{
public static void Main(string[] args)
{
Console.WriteLine("Input a number");
string inputAsString = ConsoleReadLine();
int myNumber = int.Parse(Console.ReadLine());
// Do some magic with myNumber
Console.WriteLine ($"{myNumber}, I won!");
}
}
}
Can anyone please help me to solve it?