Update Lesson 1 Task 3
This commit is contained in:
parent
62266346ac
commit
49969a1b5f
1 changed files with 18 additions and 14 deletions
|
@ -11,18 +11,22 @@ for (int i = 0; i < 10; i++)
|
|||
{
|
||||
int newNumber;
|
||||
|
||||
do
|
||||
while (true)
|
||||
{
|
||||
Console.Write($"Enter number {i + 1}: ");
|
||||
} while (!int.TryParse(Console.ReadLine(), out newNumber));
|
||||
if (int.TryParse(Console.ReadLine(), out newNumber))
|
||||
break;
|
||||
}
|
||||
|
||||
numbers.Add(newNumber);
|
||||
}
|
||||
|
||||
do
|
||||
while (true)
|
||||
{
|
||||
Console.Write("Enter a number to duplicate: ");
|
||||
} while (!int.TryParse(Console.ReadLine(), out duplicate));
|
||||
Console.Write($"Enter number to duplicate: ");
|
||||
if (int.TryParse(Console.ReadLine(), out duplicate))
|
||||
break;
|
||||
}
|
||||
|
||||
for (int i = 0; i < numbers.Count; i++) {
|
||||
if (numbers[i] == duplicate)
|
||||
|
|
Reference in a new issue