Given an integer n of ndigits, I want to write a function which returns a value which is 1 followed by (ndigits-1) number of zeroes.
Example: If I give 12345, I should get 10000
The below code does the same. However, I would like to know if there is a more efficient way(s) to obtain the same result. Kindly post your thoughts regarding this:
int func(int n)
for(i=1; n>10; n/=10,i*=10)