C#:Réponses aux exercices 3
C#:Réponses aux exercices 3Solutions Exercice instruction While 001Enoncéusing System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace exerciceInstructionWhile001 { class Program { static void Main(string[] args) { // utilisationBouclefor(); utilisationBoucleWhile(); } static void utilisationBouclefor() { int x; int y; for (x = 1; x <= 10; x++) { System.Console.WriteLine("Cas : " + x); for (y = 1; y <= 10; y++) { System.Console.WriteLine(x + " X " + y + " =" + x * y); } } } static void utilisationBoucleWhile() { int x=1; int y=1; while(x<=10) { System.Console.WriteLine("Cas : " + x); y = 1; while(y<=10) { System.Console.WriteLine(x + " X " + y + " =" + x * y); y ++; } x ++; } } } } |