For divide, one could do something like this (below would be digit2 / digit1):
int movingNum = 0;
int i = 0;
while(movingNum < digit2){
// This is the counter of how many times digit1 goes into digit2, increment it
// because the running sum is still less than digit2
i++;
// increment the moving sum by digit1 so that it is larger by digit1 moving through
// the next iteration of the loop
movingNum += digit1;
}
cout << "digit1 goes into digit2 " << i << " times.";
For digit1 / digit2:
int movingNum = 0;
int i = 0;
while(movingNum < digit1){
// This is the counter of how many times digit2 goes into digit1, increment it
// because the running sum is still less than digit1
i++;
// increment the moving sum by digit2 so that it is larger by digit2 moving through
// the next iteration of the loop
movingNum += digit2;
}
cout << "digit2 goes into digit1 " << i << " times.";
These are obviously for integer divide, if the two inputs do not divide equally, then there will be a remainder. This remainder can be calculated after the above loop by:
int remainder = movingNum - digit2;
If you are truly looking for a floating point answer / result, this would be an entirely different answer.