Opzione 4
This commit is contained in:
parent
6014c313b2
commit
b00a9cea81
13
Program.cs
13
Program.cs
@ -17,7 +17,7 @@ class Program {
|
|||||||
Console.WriteLine("1. Crea e mostra matrice quadrata");
|
Console.WriteLine("1. Crea e mostra matrice quadrata");
|
||||||
Console.WriteLine("2. Somma diagonale secondaria");
|
Console.WriteLine("2. Somma diagonale secondaria");
|
||||||
Console.WriteLine("3. Media diagonale secondaria");
|
Console.WriteLine("3. Media diagonale secondaria");
|
||||||
Console.WriteLine("5. Prodotto diagonale principale");
|
Console.WriteLine("4. Prodotto diagonale secondaria");
|
||||||
Console.WriteLine("6. Valore minimo e massimo diagonale principale");
|
Console.WriteLine("6. Valore minimo e massimo diagonale principale");
|
||||||
Console.WriteLine("7. Trova zeri sulla diagonale principale");
|
Console.WriteLine("7. Trova zeri sulla diagonale principale");
|
||||||
Console.WriteLine("8. Cerca sulla diagonale principale");
|
Console.WriteLine("8. Cerca sulla diagonale principale");
|
||||||
@ -59,10 +59,10 @@ class Program {
|
|||||||
case 4:
|
case 4:
|
||||||
Console.Clear();
|
Console.Clear();
|
||||||
if (matrix != null) {
|
if (matrix != null) {
|
||||||
//Console.WriteLine($"La media degli elementi della diagonale principale è {SommaMatriceDiagonale(matrix) / matrix.GetLength(0)}");
|
Console.WriteLine($"Il prodotto degli elementi della diagonale principale è {ProdottoMatriceDiagonale2(matrix)}");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Console.WriteLine("È necessario creare la matrice prima di calcolare la media della diagonale principale.");
|
Console.WriteLine("È necessario creare la matrice prima di calcolare il prodotto della diagonale principale.");
|
||||||
}
|
}
|
||||||
Pausa();
|
Pausa();
|
||||||
break;
|
break;
|
||||||
@ -165,4 +165,11 @@ class Program {
|
|||||||
}
|
}
|
||||||
return ritorno;
|
return ritorno;
|
||||||
}
|
}
|
||||||
|
static int ProdottoMatriceDiagonale2(int[,] p_matrice) {
|
||||||
|
int ritorno = 1;
|
||||||
|
for (int r = 0; r < p_matrice.GetLength(0); r++) {
|
||||||
|
ritorno = ritorno * p_matrice[r, p_matrice.GetLength(1) - 1 - r];
|
||||||
|
}
|
||||||
|
return ritorno;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
@ -13,10 +13,10 @@ using System.Reflection;
|
|||||||
[assembly: System.Reflection.AssemblyCompanyAttribute("matrix_3")]
|
[assembly: System.Reflection.AssemblyCompanyAttribute("matrix_3")]
|
||||||
[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+2a271926848667bcddcead0052bc6ea47fdebd86")]
|
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+6014c313b202cd6198ffad5fdc9677bf63ff7c11")]
|
||||||
[assembly: System.Reflection.AssemblyProductAttribute("matrix_3")]
|
[assembly: System.Reflection.AssemblyProductAttribute("matrix_3")]
|
||||||
[assembly: System.Reflection.AssemblyTitleAttribute("matrix_3")]
|
[assembly: System.Reflection.AssemblyTitleAttribute("matrix_3")]
|
||||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||||
|
|
||||||
// Generated by the MSBuild WriteCodeFragment class.
|
// Generato dalla classe WriteCodeFragment di MSBuild.
|
||||||
|
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
7aca69c8efa80f19ce3e2ea6d36183ecb1eed8e8b6ea588310183037a98ae435
|
c406b3a08bd253a1bcf5b3ae92da91aa3d5278f12f55945bc57b8ccec301f14d
|
||||||
|
|||||||
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