Exercise correction
bedia18
-
bedia18 -
bedia18 -
```delphi
program tableau ;
uses crt;
type T_tab = array [ 1..20 ] of integer ;
var tnbre : T_tab; i, grd : integer ;
begin
for i := 1 to 20 do
begin
repeat
writeln ( 'entrez votre nombre :' );
readln ( tnbre [i] );
until tnbre [i] > 0;
end;
grd := tnbre [1];
for i := 2 to 20 do
begin
if ( grd < tnbre [i] ) then
begin
grd := tnbre [i];
end;
end;
writeln('le plus grand élément est :', grd);
readkey;
end.
```
program tableau ;
uses crt;
type T_tab = array [ 1..20 ] of integer ;
var tnbre : T_tab; i, grd : integer ;
begin
for i := 1 to 20 do
begin
repeat
writeln ( 'entrez votre nombre :' );
readln ( tnbre [i] );
until tnbre [i] > 0;
end;
grd := tnbre [1];
for i := 2 to 20 do
begin
if ( grd < tnbre [i] ) then
begin
grd := tnbre [i];
end;
end;
writeln('le plus grand élément est :', grd);
readkey;
end.
```
5 answers
Hello,
You forgot to specify the programming language used. It's essential ;-)
For future messages, remember to use code tags. Here's a little tutorial https://codes-sources.commentcamarche.net/faq/11288-les-balises-de-code
Above the message editing area, there are icons for text enrichment. The one that looks like
And when you run your code, does it work, does it give error messages, ...?
You forgot to specify the programming language used. It's essential ;-)
For future messages, remember to use code tags. Here's a little tutorial https://codes-sources.commentcamarche.net/faq/11288-les-balises-de-code
Above the message editing area, there are icons for text enrichment. The one that looks like
<>▼allows you to apply the format corresponding to the nature of the code.
And when you run your code, does it work, does it give error messages, ...?