Opzione 2
This commit is contained in:
parent
e1c4d5e33e
commit
018f63991b
24
Program.cs
24
Program.cs
@ -4,8 +4,9 @@ class Program
|
|||||||
{
|
{
|
||||||
static void Main(string[] args)
|
static void Main(string[] args)
|
||||||
{
|
{
|
||||||
//dichiarazione variabili
|
//dichiarazione e inizializzazione variabili
|
||||||
int scelta, i, numero;
|
int scelta, i, numero, somma;
|
||||||
|
somma = 0;
|
||||||
bool positiviPari = true;
|
bool positiviPari = true;
|
||||||
//menu
|
//menu
|
||||||
do {
|
do {
|
||||||
@ -22,24 +23,22 @@ class Program
|
|||||||
case 0:
|
case 0:
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
do
|
do{
|
||||||
{
|
|
||||||
Console.Write("Numeri da inserire: ");
|
Console.Write("Numeri da inserire: ");
|
||||||
i = Convert.ToInt32(Console.ReadLine());
|
i = Convert.ToInt32(Console.ReadLine());
|
||||||
if (i <= 0)
|
if (i <= 0){
|
||||||
{
|
|
||||||
Console.WriteLine("Opzione non valida");
|
Console.WriteLine("Opzione non valida");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while (i <= 0);
|
while (i <= 0);
|
||||||
for(; i > 0; i--){
|
for (; i > 0; i--){
|
||||||
Console.Write("Inserire un numero: ");
|
Console.Write("Inserire un numero: ");
|
||||||
numero = Convert.ToInt32(Console.ReadLine());
|
numero = Convert.ToInt32(Console.ReadLine());
|
||||||
if(numero < 0 || numero % 2 != 0){
|
if(numero < 0 || numero % 2 != 0){
|
||||||
positiviPari = false;
|
positiviPari = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(positiviPari == true){
|
if (positiviPari == true){
|
||||||
Console.WriteLine("Tutti positivi e pari");
|
Console.WriteLine("Tutti positivi e pari");
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
@ -47,6 +46,15 @@ class Program
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
|
do{
|
||||||
|
Console.Write("Inserire un numero: ");
|
||||||
|
numero = Convert.ToInt32(Console.ReadLine());
|
||||||
|
if (!((numero < 0 && numero % 2 == 0) || (numero >= 0 && numero % 3 == 0))){
|
||||||
|
somma = somma + numero;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
while (!((numero < 0 && numero % 2 == 0) || (numero >= 0 && numero % 3 == 0)));
|
||||||
|
Console.WriteLine("Somma: " + somma);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
break;
|
break;
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -13,7 +13,7 @@ using System.Reflection;
|
|||||||
[assembly: System.Reflection.AssemblyCompanyAttribute("ripasso1")]
|
[assembly: System.Reflection.AssemblyCompanyAttribute("ripasso1")]
|
||||||
[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+523bb24b6cdf5fe528dfd83a3e99519698c6b70f")]
|
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+e1c4d5e33e3928d02e8d2d8c5dad601ee6a069b7")]
|
||||||
[assembly: System.Reflection.AssemblyProductAttribute("ripasso1")]
|
[assembly: System.Reflection.AssemblyProductAttribute("ripasso1")]
|
||||||
[assembly: System.Reflection.AssemblyTitleAttribute("ripasso1")]
|
[assembly: System.Reflection.AssemblyTitleAttribute("ripasso1")]
|
||||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
9ae844eabdb834620e40c9ba6eb3b842d15c778fa257263021e9ad9254162faf
|
f2c5cde86cd7c9aecef2ceb3af53f8d967d88c13fffb33996563a5258c59d278
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user