Hi..I recently faced this question in an interview.How to multiply a number by 7 without using multiplication operator?I could not answer it.Thanks for any reply.
Hi..I recently faced this question in an interview.How to multiply a number by 7 without using multiplication operator?I could not answer it.Thanks for any reply.
jerico
you could add the number 7 times, e.g. k=j*7
Code:
k=0;
for(int l=0; l<7; l++) k=k+j;
you could shift left 3 bits (multiply by 8) and subtract, e.g.
Comment