1 Replies - 2796 Views - Last Post: 13 August 2007 - 08:10 AM Rate Topic: -----

#1 dianenacario  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 08-August 07

integer divison without / or %

Posted 13 August 2007 - 06:07 AM

int[] Divide(int divisor, int dividend)
{
int remainder = dividend;
int quotient = 0;

while (remainder >= divisor)
{
remainder -= divisor;
quotient++;
}

return new int[] { quotient, remainder };
}


[b] i am trying to do a divison program..
i should not use " / or %"
i should only use a while loop or a for loop.


i wanted it to be like this,

output of program: any number % any number = quotient
input dividend: dividend
input divisor: divisor
quotient: quotient
remainder: if there is a remainder[i]


Is This A Good Question/Topic? 0
  • +

Replies To: integer divison without / or %

#2 csmanoj  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 10
  • View blog
  • Posts: 150
  • Joined: 06-August 07

Re: integer divison without / or %

Posted 13 August 2007 - 08:10 AM

What about this? - http://www.dreaminco...wtopic31434.htm

And could you please put your code inside code blocks so its clearer?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1