division by 7 without using division operator
- From: krypto.wizard@xxxxxxxxx
- Date: 31 Jan 2007 20:03:38 -0800
Last month I appeared for an interview with EA sports and they asked
me this question.
How would you divide a number by 7 without using division operator ?
I did by doing a subtraction and keeping a counter that kept a tab on
how many times I subtracted.
Later, the EA sport guy told me that of course there are can be better
technique by using bit operator.
Since 7 has a binary representation 111, my guess is that a left shift
operation of 3 bits should give the answer, but I couldn't get it to
work.
Any comments ?
.
- Follow-Ups:
- Re: division by 7 without using division operator
- From: quarkLore
- Re: division by 7 without using division operator
- From: Francois Grieu
- Re: division by 7 without using division operator
- From: Ico
- Re: division by 7 without using division operator
- From: Duncan Muirhead
- Re: division by 7 without using division operator
- From: Richard Heathfield
- Re: division by 7 without using division operator
- From: websnarf
- Re: division by 7 without using division operator
- From: Keith Thompson
- Re: division by 7 without using division operator
- From: Ben Pfaff
- Re: division by 7 without using division operator
- From: Jeffrey Stedfast
- Re: division by 7 without using division operator
- From: CBFalconer
- Re: division by 7 without using division operator
- From: Christopher Layne
- Re: division by 7 without using division operator
- From: David T. Ashley
- Re: division by 7 without using division operator
- Prev by Date: Re: How to reduce Zero Initialised region.
- Next by Date: Re: effect of volatile in this example
- Previous by thread: effect of volatile in this example
- Next by thread: Re: division by 7 without using division operator
- Index(es):
Relevant Pages
|