Witajcie,
problem jest tego typu że chciałem dodać warunki do wporwadzanej zmiennej żeby mi się program nie sypał ale zatrzymałem się na w tym punkcie i nie wiem co dalej.
Pomoże ktoś?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Zadanie13
{
class Program
{
static void Main(string[] args)
{
int[] tab = new int[500];
int b = 0;
for (int i = 0; i < 499; i++)
{
while (true)
{
Console.WriteLine("Podaj liczbę: ");
tab[i] = int.Parse(Console.ReadLine());
try
{
int = int.Parse(i);
break;
}
catch (FormatException)
{
Console.WriteLine("Wprowadzono liczbę w złym formacie");
}
catch (OverflowException)
{
Console.WriteLine("Wprowadzona liczba jest poza dopuszczalnym zakresem");
}
catch (ArgumentNullException)
{
Console.WriteLine("Napotkano koniec strumienia");
}
Console.WriteLine("Spróbuj jeszcze raz");
}
tab[i] = int.Parse(Console.ReadLine());
b += tab[i];
if (tab[i] == 0)
{
Console.WriteLine("Suma liczb wpisanych wynosi: " + b);
Console.ReadKey();
return;
}
}
}
}
}