Advertisement
Guest User

Untitled

a guest
May 21st, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. Var
  2. a1,a2,k,i,k10,k5,k2,k1,n:integer;
  3. Begin
  4. randomize;
  5. n:=random(10,20);
  6. writeln(n);
  7. writeln;
  8. a1 := random(10,100);
  9. writeln(a1);
  10. for i:=2 to n do
  11. begin
  12. if (a1 mod 10 = 0) then inc(k10)
  13. else if (a1 mod 5 = 0) then inc(k5)
  14. else if (a1 mod 2 = 0) then inc(k2)
  15. else inc(k1);
  16. a2:=random(10,100);
  17. writeln(a2);
  18. if (a2 mod 10 = 0) then k:=k + k10 + k5 + k2 + k1
  19. else if (a2 mod 5 = 0) then k:= k +k10 + k2
  20. else if (a2 mod 2 = 0) then k:= k + k10 + k5
  21. else k:= k + k10;
  22. a1:=a2;
  23. end;
  24. writeln;
  25. writeln(k);
  26.  
  27. End.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement