Advertisement
LePetitGlacon

FICHE 5 BASE Exercice 4

Oct 8th, 2019
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.60 KB | None | 0 0
  1. using System;
  2.  
  3. namespace p
  4. {
  5.     class Program
  6.     {
  7.         public static void Main(string[] args)
  8.         {
  9.             Console.WriteLine("nombre colonne");
  10.             int nombre1 = int.Parse(Console.ReadLine());
  11.             Console.WriteLine("nombre ligne");
  12.             int nombre2 = int.Parse(Console.ReadLine());
  13.            
  14.             int nbcompteur1 = 1;
  15.             int compteur1 = 0;
  16.            
  17.            
  18.            
  19.             Console.Write("\t");
  20.                 //premiere ligne
  21.                 while (compteur1 != nombre1)
  22.                 {
  23.                     Console.Write(nombre1 - nombre1 + nbcompteur1 + "   ");
  24.                     compteur1++;
  25.                     nbcompteur1++;
  26.                 }
  27.              
  28.                 Console.WriteLine("\n");
  29.                
  30.                 int colonne = 1;
  31.                 int ligne = 0;
  32.                 int multiplication = 1;
  33.                
  34.                 while (colonne <= nombre2)
  35.                 {
  36.                         Console.Write(colonne);
  37.                    
  38.                     while (ligne != nombre2)
  39.                     {
  40.                         Console.Write("\t" + colonne * multiplication);
  41.                        
  42.                         multiplication++;
  43.                         ligne++;
  44.                     }
  45.                     if (ligne == nombre2)
  46.                     {
  47.                         Console.WriteLine("\n");
  48.                     }
  49.                     colonne++;
  50.                     ligne = 0;
  51.                     multiplication = 1;
  52.                    
  53.                 }
  54.          
  55.             Console.ReadKey();
  56.         }
  57.     }
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement