Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Napiste program ktorý si vypýta celé čisla matice RxS vypíše ju na obrazovku a
- //vypíše informáciu aká je max hodnota a na akej pozícii sa nachádza.
- //min
- program minmaxmatica;
- {$APPTYPE CONSOLE}
- uses SysUtils;
- var r,s,i,j,max,min:byte;
- c:array[1..255,1..255] of byte;
- maxs,mins:string;
- begin
- { TODO -oUser -cConsole Main : Insert code here }
- write('Zadajte pocet riadkov: ');
- readln(r);
- write('Zadajte pocet stlpcov: ');
- readln(s);
- max:=0; min:=255;
- for i:=1 to r do
- begin
- for j:=1 to s do
- begin
- write('Zadajte cislo pre suradnicu (',i,',',j,'): ');
- readln(c[i,j]);
- if c[i,j]>max then
- begin
- max:=c[i,j];
- maxs:=inttostr(i)+','+inttostr(j);
- end;
- if c[i,j]<min then
- begin
- min:=c[i,j];
- mins:=inttostr(i)+','+inttostr(j);
- end;
- end;
- end;
- for i:=1 to r do
- begin
- for j:=1 to s do
- begin
- write(c[i,j]:5);
- end;
- writeln;
- end;
- write('Maximalne cislo je: ',max);
- writeln(' Nachadza sa na suradnici: ',maxs);
- write('Minimalne cislo je: ',min);
- writeln(' Nachadza sa na suradnici: ',mins);
- readln;
- end.
Advertisement
Add Comment
Please, Sign In to add comment