Terzo e quarto elemento funzionanti
This commit is contained in:
parent
8d7b26661d
commit
7ba7b81980
37
Program.cs
37
Program.cs
@ -7,8 +7,8 @@ class Program
|
|||||||
|
|
||||||
uint scelta;
|
uint scelta;
|
||||||
double celsius, fahrenheit;
|
double celsius, fahrenheit;
|
||||||
int numero, quadrato;
|
int numero, quadrato, negativo, assoluto;
|
||||||
bool exit=false;
|
bool exit=false, pari;
|
||||||
|
|
||||||
Console.Clear();
|
Console.Clear();
|
||||||
do{
|
do{
|
||||||
@ -45,9 +45,28 @@ class Program
|
|||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
Console.Clear();
|
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;
|
break;
|
||||||
case 4:
|
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;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
break;
|
break;
|
||||||
@ -72,4 +91,16 @@ class Program
|
|||||||
static int CalcolaQuadrato(int p_numero){
|
static int CalcolaQuadrato(int p_numero){
|
||||||
return p_numero*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;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
@ -13,7 +13,7 @@ using System.Reflection;
|
|||||||
[assembly: System.Reflection.AssemblyCompanyAttribute("miscellanea")]
|
[assembly: System.Reflection.AssemblyCompanyAttribute("miscellanea")]
|
||||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
[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.AssemblyProductAttribute("miscellanea")]
|
||||||
[assembly: System.Reflection.AssemblyTitleAttribute("miscellanea")]
|
[assembly: System.Reflection.AssemblyTitleAttribute("miscellanea")]
|
||||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
cd37d2e07e8e322e1e0b99a560dcb280de39c0c917143775811e224e8e743af7
|
a641cf65aa001c293b1228046a124937b0e511f5c570f7cf40b37768407d155f
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user