Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Write a function to divide a number by 3 without using /, % and * operators. itoa() available?

Tags:

algorithm

math

I tried to solve it myself but I could not get any clue.

Please help me to solve this.

like image 909
SIVA Avatar asked Jan 15 '10 11:01

SIVA


1 Answers

Are you supposed to use itoa() for this assignment? Because then you could use that to convert to a base 3 string, drop the last character, and then restore back to base 10.

like image 123
stuartd Avatar answered Oct 19 '22 22:10

stuartd