diff --git a/Program.cs b/Program.cs index 376087d..f1115a1 100644 --- a/Program.cs +++ b/Program.cs @@ -7,8 +7,8 @@ class Program uint scelta; double celsius, fahrenheit; - int numero, quadrato; - bool exit=false; + int numero, quadrato, negativo, assoluto; + bool exit=false, pari; Console.Clear(); do{ @@ -45,9 +45,28 @@ class Program break; case 3: Console.Clear(); - + Console.Write("Inserire un numero: "); + negativo=Convert.ToInt32(Console.ReadLine()); + assoluto=CalcolaValoreAssoluto(negativo); + Console.WriteLine("Il valore assoluto di " +negativo + " è " +assoluto); + Console.WriteLine("Premere invio per continuare . . ."); + Console.ReadLine(); + Console.Clear(); break; case 4: + Console.Clear(); + Console.Write("Inserire un numero: "); + numero=Convert.ToInt32(Console.ReadLine()); + pari=VerificaNumeroPari(numero); + if (pari==true){ + Console.WriteLine("Il numero " +numero + " è pari"); + } + else{ + Console.WriteLine("Il numero " +numero + " è dispari"); + } + Console.WriteLine("Premere invio per continuare . . ."); + Console.ReadLine(); + Console.Clear(); break; case 5: break; @@ -72,4 +91,16 @@ class Program static int CalcolaQuadrato(int p_numero){ return p_numero*p_numero; } + static int CalcolaValoreAssoluto(int p_numero){ + const int costante1=31; + return (p_numero + (p_numero >> costante1)) ^ (p_numero >> costante1); + } + static bool VerificaNumeroPari(int p_numero){ + if (p_numero%2==0){ + return true; + } + else{ + return false; + } + } } diff --git a/bin/Debug/net9.0/miscellanea.dll b/bin/Debug/net9.0/miscellanea.dll index 2258854..78e80fb 100644 Binary files a/bin/Debug/net9.0/miscellanea.dll and b/bin/Debug/net9.0/miscellanea.dll differ diff --git a/bin/Debug/net9.0/miscellanea.pdb b/bin/Debug/net9.0/miscellanea.pdb index cb5bfa9..b3e6bc9 100644 Binary files a/bin/Debug/net9.0/miscellanea.pdb and b/bin/Debug/net9.0/miscellanea.pdb differ diff --git a/obj/Debug/net9.0/miscellanea.AssemblyInfo.cs b/obj/Debug/net9.0/miscellanea.AssemblyInfo.cs index f57ef13..dfbeb7c 100644 --- a/obj/Debug/net9.0/miscellanea.AssemblyInfo.cs +++ b/obj/Debug/net9.0/miscellanea.AssemblyInfo.cs @@ -13,7 +13,7 @@ using System.Reflection; [assembly: System.Reflection.AssemblyCompanyAttribute("miscellanea")] [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] -[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+cc5900be0d2e03e61bbb8cd7a905845300a7224d")] +[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+8d7b26661d5591a9d008786305e66a141d43841a")] [assembly: System.Reflection.AssemblyProductAttribute("miscellanea")] [assembly: System.Reflection.AssemblyTitleAttribute("miscellanea")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] diff --git a/obj/Debug/net9.0/miscellanea.AssemblyInfoInputs.cache b/obj/Debug/net9.0/miscellanea.AssemblyInfoInputs.cache index 0a7510d..0daae19 100644 --- a/obj/Debug/net9.0/miscellanea.AssemblyInfoInputs.cache +++ b/obj/Debug/net9.0/miscellanea.AssemblyInfoInputs.cache @@ -1 +1 @@ -cd37d2e07e8e322e1e0b99a560dcb280de39c0c917143775811e224e8e743af7 +a641cf65aa001c293b1228046a124937b0e511f5c570f7cf40b37768407d155f diff --git a/obj/Debug/net9.0/miscellanea.dll b/obj/Debug/net9.0/miscellanea.dll index 2258854..78e80fb 100644 Binary files a/obj/Debug/net9.0/miscellanea.dll and b/obj/Debug/net9.0/miscellanea.dll differ diff --git a/obj/Debug/net9.0/miscellanea.pdb b/obj/Debug/net9.0/miscellanea.pdb index cb5bfa9..b3e6bc9 100644 Binary files a/obj/Debug/net9.0/miscellanea.pdb and b/obj/Debug/net9.0/miscellanea.pdb differ diff --git a/obj/Debug/net9.0/ref/miscellanea.dll b/obj/Debug/net9.0/ref/miscellanea.dll index f1ee168..753992c 100644 Binary files a/obj/Debug/net9.0/ref/miscellanea.dll and b/obj/Debug/net9.0/ref/miscellanea.dll differ diff --git a/obj/Debug/net9.0/refint/miscellanea.dll b/obj/Debug/net9.0/refint/miscellanea.dll index f1ee168..753992c 100644 Binary files a/obj/Debug/net9.0/refint/miscellanea.dll and b/obj/Debug/net9.0/refint/miscellanea.dll differ