Advertisement
Guest User

Untitled

a guest
Jan 16th, 2017
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. procedure TForm1.Button1Click(Sender: TObject);
  2. var i,j, ilosc, ilosc2: integer;
  3. begin
  4. Label1.Caption:='';
  5. ilosc:=0;
  6. ilosc2:=0;
  7. for i:=1 to 4 do
  8. begin
  9. for j:=1 to 4 do
  10. begin
  11. tablica[i,j]:=RandomRange(2,10);
  12. end;
  13. end;
  14. for i:=1 to 5 do
  15. begin
  16. for j:=1 to 5 do
  17. begin
  18. //Skrajny
  19. if i=1 then
  20. begin
  21. if tablica[i,j]=2 then
  22. begin
  23. ilosc:=ilosc+1;
  24. end;
  25. if tablica[i,j]=6 then
  26. begin
  27. ilosc2:=ilosc2+1;
  28. end;
  29. end;
  30. //Skrajny
  31. if i=4 then
  32. if tablica[i,j]=2 then
  33. begin
  34. ilosc:=ilosc+1;
  35. end;
  36. if tablica[i,j]=6 then
  37. begin
  38. ilosc2:=ilosc2+1;
  39. end;
  40.  
  41. end;
  42. end;
  43.  
  44. Label1.Caption:='Znalazlem ' + IntToStr(ilosc) + ' dwójek i ' + IntToStr(ilosc2) + ' szóstek.';
  45.  
  46. end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement