{ KOCKY_PERCENTA.PAS Copyright (c) Danciwo } { Program vygeneruje 20 cisel od 1 do 6 a vypise percentualne } { zastupenie. } { } { Author: Danciwo } { Date : 15.02.2008 http://www.trsek.com } program kocky_precenta; uses crt; var i,a,j:integer; p1,p2,p3,p4,p5,p6,b,c,d,f,g,h:real; begin p1:=0; p2:=0; p3:=0; p4:=0; p5:=0; p6:=0; clrscr; randomize; writeln('Program vygeneruje 20 cisel od 1 do 6 a vypise percentualne zastupenie'); writeln; for i:= 1 to 20 do begin a:= random (6)+1; write (' ',a); if a= 1 then p1:=p1+1; if a= 2 then p2:=p2+1; if a= 3 then p3:=p3+1; if a= 4 then p4:=p4+1; if a= 5 then p5:=p5+1; if a= 6 then p6:=p6+1; end; writeln; writeln; b:= p1/20 * 100; c:= p2/20 * 100; d:= p3/20 * 100; f:= p4/20 * 100; g:= p5/20 * 100; h:= p6/20 * 100; writeln ('Jednotiek je ',b:2:2,'%'); writeln ('Dvojek je ',c:2:2,'%'); writeln ('Trojek je ',d:2:2,'%'); writeln ('Stvoriek je ',f:2:2,'%'); writeln ('Patiek je ',g:2:2,'%'); writeln ('Sestiek je ',h:2:2,'%'); readln; end.