LOVEGUN

Application Alternatif (Les Algorithmes Recurrents)

Jan 14th, 2021
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 0.93 KB | None | 0 0
  1. Program MinimumLigneMat;
  2. Uses Wincrt;
  3. Type
  4.   tab = Array [1..20,1..20] Of Integer;
  5. Var
  6.   t: tab;
  7.   l,c: Integer;
  8. Procedure remplir (Var t:tab;Var l,c:Integer);
  9. Var
  10.   i,j: Integer;
  11. Begin
  12.   Writeln ('Saisir la ligne: ');
  13.   Readln (l);
  14.   Writeln ('Saisir le nombre de colonne');
  15.   Readln (c);
  16.   Randomize;
  17.   For i:=1 To l Do
  18.     For j:=1 To c Do
  19.       t[i,j] := Random(10);
  20.   For i:=1 To l Do
  21.     Begin
  22.       Writeln ;
  23.       For j:=1 To c Do
  24.         Write (t[i,j],' | ');
  25.     End;
  26. End;
  27.  
  28. Function min (t:tab;i,c:Integer): Integer;
  29. Var
  30.   j,x: Integer;
  31. Begin
  32.   x := t[i,1];
  33.   For j:=1 To c Do
  34.     If t[i,j]<x Then x := t[i,j];
  35.   min := x;
  36. End;
  37.  
  38. Procedure affiche (t:tab;l:Integer);
  39. Var i: Integer;
  40.   t1: Array [1..20] Of Integer;
  41. Begin
  42.   For i:=1 To l Do
  43.     t1[i] := min(t,i,c);
  44.   Writeln;
  45.   For i:=1 To l Do
  46.     Writeln ('Min ligne ',i,' : ',t1[i]);
  47. End;
  48. Begin
  49.   remplir (t,l,c);
  50.     affiche (t,l);
  51. End.
  52.  
Advertisement
Add Comment
Please, Sign In to add comment