Opzione 2
This commit is contained in:
parent
e1c4d5e33e
commit
018f63991b
26
Program.cs
26
Program.cs
@ -4,8 +4,9 @@ class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
//dichiarazione variabili
|
||||
int scelta, i, numero;
|
||||
//dichiarazione e inizializzazione variabili
|
||||
int scelta, i, numero, somma;
|
||||
somma = 0;
|
||||
bool positiviPari = true;
|
||||
//menu
|
||||
do {
|
||||
@ -22,24 +23,22 @@ class Program
|
||||
case 0:
|
||||
break;
|
||||
case 1:
|
||||
do
|
||||
{
|
||||
do{
|
||||
Console.Write("Numeri da inserire: ");
|
||||
i = Convert.ToInt32(Console.ReadLine());
|
||||
if (i <= 0)
|
||||
{
|
||||
if (i <= 0){
|
||||
Console.WriteLine("Opzione non valida");
|
||||
}
|
||||
}
|
||||
while (i <= 0);
|
||||
for(; i > 0; i--){
|
||||
for (; i > 0; i--){
|
||||
Console.Write("Inserire un numero: ");
|
||||
numero = Convert.ToInt32(Console.ReadLine());
|
||||
if(numero < 0 || numero % 2 != 0){
|
||||
positiviPari = false;
|
||||
}
|
||||
}
|
||||
if(positiviPari == true){
|
||||
if (positiviPari == true){
|
||||
Console.WriteLine("Tutti positivi e pari");
|
||||
}
|
||||
else{
|
||||
@ -47,7 +46,16 @@ class Program
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
break;
|
||||
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;
|
||||
case 3:
|
||||
break;
|
||||
case 4:
|
||||
|
||||
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.AssemblyConfigurationAttribute("Debug")]
|
||||
[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.AssemblyTitleAttribute("ripasso1")]
|
||||
[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