Professional Documents
Culture Documents
Compiti Estivi
Compiti Estivi
1. Sviluppare un programma che dato un numero intero
positivo, visualizzi i 10 numeri pari superiori al numero
inserito.
CODICE:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ES1
class Program
int n = Convert.ToInt32(ReadLine());
if(num == n)
n = n+2;
WriteLine(n);
else
n = n+1;
WriteLine(n);
n = n+2;
WriteLine(n);
IDEA RISOLUTIVA:
CODICE:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace es2
class Program
int a = Convert.ToInt32(ReadLine());
int b = dimensione - 2;
Console.WriteLine();
Write("* ");
else
if(i == 0 || i == dimensione)
Write("* ");
else
Write("* ");
Write("");
Write("* ");
Console.WriteLine();
Write("* ");
CODICE:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace es4
class Program
int cont = 1;
cont++;
IDEA RISOLUTIVA:
CODICE:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace es5
class Program
bool scambio;
do
scambio = false;
v[i] = v[v+1];
v[i+1] = temp;
scambio = true;
} while (scambio);
return v;
int j = 0;
int a = v[i];
v[j+1] = v[j];
v[j+1] = a;
return v;
int m;
m = i;
m = j;
v[m] = v[i];
v[i] = temp;
return v;
IDEA RISOLUTIVA:
CODICE:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace es6
class Program
int i = 0;
int j = 0;
int k = 0;
v2[k] = v[i];
i++;
k++;
else
v2[k] = v1[j];
j++;
k++;
if(i<v.Length)
v2[k] = v[i];
i++;
k++;
if(j<v1.Length)
v2[k] = v1[j];
j++;
k++;
return v2;