Rajath N R wrote:
> Hi All,
> I have 2 idea...
>
> 1)
> main()
> {
> int j, i = 1234;
> for ( j = i; j > 100; j /= 10)
> ;
> printf("%d\n", j);
> }
Novel approach. Won't work on multiples of 100.
100, 1000, 10000, etc.
for (j = i; j >= 100; j /= 10);
Would be more correct.
But both are unnecessary. Just do 'i / 100'.
--
Thomas Hruska
CubicleSoft President
Ph: 517-803-4197
*NEW* MyTaskFocus 1.1
Get on task. Stay on task.
http://www.CubicleSoft.com/MyTaskFocus/
