diff --git a/Program.cs b/Program.cs index 00101f7..0ed7c5b 100644 --- a/Program.cs +++ b/Program.cs @@ -5,9 +5,12 @@ class Program static void Main(string[] args) { //dichiarazione e inizializzazione variabili - int scelta, i, numero, somma; + int scelta, i, numero, somma, tmp; somma = 0; - bool positiviPari = true; + tmp = 0; + bool positiviPari, positivoNegativo; + positiviPari = true; + positivoNegativo = false; //menu do { Console.WriteLine("Scegliere un'opzione:"); @@ -23,6 +26,7 @@ class Program case 0: break; case 1: + positiviPari = true; do{ Console.Write("Numeri da inserire: "); i = Convert.ToInt32(Console.ReadLine()); @@ -34,7 +38,7 @@ class Program for (; i > 0; i--){ Console.Write("Inserire un numero: "); numero = Convert.ToInt32(Console.ReadLine()); - if(numero < 0 || numero % 2 != 0){ + if(numero < 0 || numero % 2 != 0){ //se non è positivo e pari positiviPari = false; } } @@ -46,10 +50,11 @@ class Program } break; case 2: + somma = 0; do{ Console.Write("Inserire un numero: "); numero = Convert.ToInt32(Console.ReadLine()); - if (!((numero < 0 && numero % 2 == 0) || (numero >= 0 && numero % 3 == 0))){ + if (!((numero < 0 && numero % 2 == 0) || (numero >= 0 && numero % 3 == 0))){ //se non è ((minore di zero e divisibile per 2) o è ((maggiore o uguale a zero) e divisibile per 3)) somma = somma + numero; } } @@ -57,7 +62,23 @@ class Program Console.WriteLine("Somma: " + somma); break; case 3: - break; + positivoNegativo = false; + do{ + Console.Write("Inserire un numero: "); + numero = Convert.ToInt32(Console.ReadLine()); + if(numero > 0 && tmp < 0){ + positivoNegativo = true; + } + tmp = numero; + } + while (numero != 0); + if(positivoNegativo){ + Console.WriteLine("OK"); + } + else{ + Console.WriteLine("NO"); + } + break; case 4: break; default: diff --git a/bin/Debug/net9.0/ripasso1.dll b/bin/Debug/net9.0/ripasso1.dll index e479168..c3eb841 100644 Binary files a/bin/Debug/net9.0/ripasso1.dll and b/bin/Debug/net9.0/ripasso1.dll differ diff --git a/bin/Debug/net9.0/ripasso1.pdb b/bin/Debug/net9.0/ripasso1.pdb index 5800ae7..2cfb8ca 100644 Binary files a/bin/Debug/net9.0/ripasso1.pdb and b/bin/Debug/net9.0/ripasso1.pdb differ diff --git a/obj/Debug/net9.0/ref/ripasso1.dll b/obj/Debug/net9.0/ref/ripasso1.dll index 383a780..8dcb25c 100644 Binary files a/obj/Debug/net9.0/ref/ripasso1.dll and b/obj/Debug/net9.0/ref/ripasso1.dll differ diff --git a/obj/Debug/net9.0/refint/ripasso1.dll b/obj/Debug/net9.0/refint/ripasso1.dll index 383a780..8dcb25c 100644 Binary files a/obj/Debug/net9.0/refint/ripasso1.dll and b/obj/Debug/net9.0/refint/ripasso1.dll differ diff --git a/obj/Debug/net9.0/ripasso1.AssemblyInfo.cs b/obj/Debug/net9.0/ripasso1.AssemblyInfo.cs index d082391..1f824c7 100644 --- a/obj/Debug/net9.0/ripasso1.AssemblyInfo.cs +++ b/obj/Debug/net9.0/ripasso1.AssemblyInfo.cs @@ -13,7 +13,7 @@ using System.Reflection; [assembly: System.Reflection.AssemblyCompanyAttribute("ripasso1")] [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] -[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+e1c4d5e33e3928d02e8d2d8c5dad601ee6a069b7")] +[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+018f63991bf194f27f28e5f478eb7c5a8784aa89")] [assembly: System.Reflection.AssemblyProductAttribute("ripasso1")] [assembly: System.Reflection.AssemblyTitleAttribute("ripasso1")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] diff --git a/obj/Debug/net9.0/ripasso1.AssemblyInfoInputs.cache b/obj/Debug/net9.0/ripasso1.AssemblyInfoInputs.cache index 076d1cd..14564c8 100644 --- a/obj/Debug/net9.0/ripasso1.AssemblyInfoInputs.cache +++ b/obj/Debug/net9.0/ripasso1.AssemblyInfoInputs.cache @@ -1 +1 @@ -f2c5cde86cd7c9aecef2ceb3af53f8d967d88c13fffb33996563a5258c59d278 +042eecfbc24d3d06289088724a32fc5b4299d5aefd8aabe9fff63f62e1ef4676 diff --git a/obj/Debug/net9.0/ripasso1.dll b/obj/Debug/net9.0/ripasso1.dll index e479168..c3eb841 100644 Binary files a/obj/Debug/net9.0/ripasso1.dll and b/obj/Debug/net9.0/ripasso1.dll differ diff --git a/obj/Debug/net9.0/ripasso1.pdb b/obj/Debug/net9.0/ripasso1.pdb index 5800ae7..2cfb8ca 100644 Binary files a/obj/Debug/net9.0/ripasso1.pdb and b/obj/Debug/net9.0/ripasso1.pdb differ