fork download
  1. program ideone;
  2. var x,k,s,c : Integer;
  3. begin
  4. Write('x='); Readln(x);
  5. Write('k='); Readln(k);
  6.  
  7. while x <> 0 do
  8. begin
  9. c := x mod 10;
  10. if c < k then s := s + c;
  11. x := x div 10;
  12. end;
  13.  
  14. WriteLn('s=', s);
  15. end.
Success #stdin #stdout 0s 288KB
stdin
1935
5
stdout
x=k=s=4