
Patrick B. answered 10/16/19
Math and computer tutor/teacher
I do not have a Pascal compiler at this time...
in C, here is some code:
using namespace std;
#include <iostream>
int Divide( int x, int y)
{
if ((x-y)>=0)
{
return(1+Divide(x-y,y));
}
else
{
return(0);
}
}
int main()
{
cout << Divide(100,3);
}
==========================================================
Translating into PASCAL:
Program RecursiveDivision (input,output);
Function Divide ( X:integer, Y:integer) : Integer
begin
if ((x-y)>=0) then
Divide: = 1 + Divide(X-y,y)
else
Divide:=0;
end;
end;
BEGIN
writeln( Divide(100,3) );
END.