fork download
  1. program m_mod_k;
  2. var k,m,x,y: integer;
  3.  
  4. begin
  5. read(m,k);
  6. x:=m; y:=k;
  7.  
  8. while x >= y do
  9. x := x - y;
  10.  
  11. writeln(m,' mod ',k,' = ', x)
  12. end.
Success #stdin #stdout 0s 5288KB
stdin
5 18
stdout
5 mod 18 = 5