using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace AugmentationNotes { class Program { static void Main(string[] args) {/**/ int ligne = 4, colonne = 5; float[,] notes ={ {90,70,80,85,100}, {95,75,85,70,90}, {100,50,70,80,60}, {80,70,60,70,40}}; int[] aug=new int[colonne];//= { 2, 3, 2, 4, 5 };// float[,] notesAug = new float[ligne, colonne]; float noteINT; //lecture du tableau Aug for (int j = 0; j < colonne; j++) { Console.Write("Donnez-moi l'augmentation du cours No {0}: ",j+1); aug[j] = int.Parse(Console.ReadLine()); } for (int i = 0; i < ligne; i++) { noteINT = notes[i, 0] + (aug[0] * notes[i, 0]) / 100; if (noteINT > 100) notesAug[i, 0] = 100; else notesAug[i, 0] = noteINT; } for (int i = 0; i < ligne; i++) { noteINT = notes[i, 1] + (aug[1] * notes[i, 1]) / 100; if (noteINT > 100) notesAug[i, 1] = 100; else notesAug[i, 1] = noteINT; } for (int i = 0; i < ligne; i++) { noteINT = notes[i, 2] + (aug[2] * notes[i, 2]) / 100; if (noteINT > 100) notesAug[i, 2] = 100; else notesAug[i, 2] = noteINT; } for (int i = 0; i < ligne; i++) { noteINT = notes[i, 3] + (aug[3] * notes[i, 3]) / 100; if (noteINT > 100) notesAug[i, 3] = 100; else notesAug[i, 3] = noteINT; } for (int i = 0; i < ligne; i++) { noteINT = notes[i, 4] + (aug[4] * notes[i, 4]) / 100; if (noteINT > 100) notesAug[i, 4] = 100; else notesAug[i, 4] = noteINT; } // la façon la plus optimale de faire ça for (int j = 0; j < colonne; j++) { for (int i = 0; i < ligne; i++) { noteINT = notes[i, j] + (aug[j] * notes[i, j]) / 100; if (noteINT > 100) notesAug[i, j] = 100; else notesAug[i, j] = noteINT; } } // Afficher l'ancien tableau Console.WriteLine("\nLes ancienne notes sont: "); Console.WriteLine(); for (int i = 0; i < ligne; i++) { for (int j = 0; j < colonne; j++) { Console.Write("{0,-10:0.00}", notes[i, j]); } Console.WriteLine(); } Console.WriteLine(); Console.WriteLine(); Console.WriteLine(); // Afficher le nouveau tableau Console.WriteLine("Les nouvelles notes sont: "); Console.WriteLine(); for (int i = 0; i < ligne; i++) { for (int j = 0; j < colonne; j++) { Console.Write("{0,-10:0.00}", notesAug[i, j]); } Console.WriteLine(); } Console.Read(); } } }