Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Program vygeneruje n čísiel a vypíśe na obrazovku tieto čísla a štatistiku pocet parnych pocet parnych max a min
- program generatorcisiel;
- {$APPTYPE CONSOLE}
- uses SysUtils;
- var i,n,c,pc,nc,max,min:byte;
- begin
- { TODO -oUser -cConsole Main : Insert code here }
- write('Kolko cisiel chcete vygenerovat?: ');
- readln(n);
- pc:=0;
- nc:=0;
- max:=0;
- min:=255;
- randomize;
- for i:=1 to n do
- begin
- c:=random(n+1);
- write(c,' ');
- if c mod 2 = 0 then pc:=c;
- if c mod 2 <> 0 then nc:=c;
- if c>max then max:=c;
- if c<min then min:=c;
- end;
- writeln;
- writeln('Maximalne cislo: ',max);
- writeln('Minimalne cislo: ',min);
- writeln('Parne cisla: ',pc);
- writeln('Neparne cisla: ',nc);
- readln;
- end.
Advertisement
Add Comment
Please, Sign In to add comment