I have an 'n' digit number. I need to print the first n - 1 digits of the same. As far as I know, it is basically division by 10. But this is to be done without using any of the arithmetic operators. I tried using some of the conversions in ctype, but since the exact length of the number, i.e. no. of digits is not known, I am unable to use the same.
i.e.
convert int to string, say 12345 to string
set the last position of it to '\0', in my case last position is not known
//i.e. 1, 2, 3, 4, '\0', assuming string size is 5
convert it back to int.// 1234
Is there any tweak, or something entirely different available for this?