I want to divide a number by integer value 3, without using ‘/’ or ‘*’. I am only allowed to use << and >>. Program should out put nearing value. For example.
8/3 = 2.66 and answer with shift can be 3.
7.3 = 2.33 and answer can be 2.
I tried doing this but there is more deviation.
Please let me know..Code:
#define DIVIDE_BY_3(uS) ((uS<<4)>>6)