Advertisement
CrazyDiver

Split wth spaces[P_ABC]

Dec 12th, 2017
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 0.54 KB | None | 0 0
  1. function WrWthSpace(n:integer):string;
  2. var res:string;
  3. begin
  4.   repeat                    //repeat until resuly eq 0
  5.     res:=n mod 10+' '+res;  //add to result variable reminder of division n on 10, add space and res
  6.     n:=n div 10;            //cut last discharge inputted num
  7.   until n=0;                //cycle end
  8.   WrWthSpace:=res;                 //assign func result variable named res(result)
  9. end;
  10. var n:integer;
  11. begin
  12.   read(n);                  //read input num
  13.   Write(WrWthSpace(n));     //write num divided by spaces
  14. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement