diff --git a/Program.cs b/Program.cs index dc25b09..7158b68 100644 --- a/Program.cs +++ b/Program.cs @@ -10,15 +10,25 @@ class Program bool opzione1=false; string input=""; int i=0; + int p=0; + int d=0; int numeri=0; int somma=0; int media=0; const int dimensione=5; const int divisibile=7; int[] insieme1=new int[dimensione]; - for (; i=dimensione){ + Console.WriteLine("E' stato inserito il numero massimo di numeri pari, riprovare."); + } + else if (d>=dimensione){ + Console.WriteLine("E' stato inserito il numero massimo di numeri dispari, riprovare."); + } + //assegnazione negli array + else { + if (input!="q"){//non si è interrotto l'inserimento + if(Convert.ToInt32(input)%2==0){//se pari + pari[p]=Convert.ToInt32(input); + p++; + } + else{ + dispari[d]=Convert.ToInt32(input); + d++; + } + } + i++; + } + } + while (input!="q" && i