- **C**
(*http://www.go4expert.com/forums/c/*)

- - **Count the length on a number**
(*http://www.go4expert.com/forums/count-length-t15410/*)

Count the length on a numberi have a very simple query?
anybody can tell me, how can i find the length of the number, which was enter by user. like:- 1234 length should be 4 thanks |

Re: Count the length on a numberJust as xpi0t0s always says.....how will you do it on paper???
I mean, can you do it as a lame-man, without any pc provided to you?? If you can, you can design your algorithm on your own.... Little hint, from my part, the way we express the integers (say e.g. abcde is an integer) is not the proper expression....it is obtained by summing up the proper expression.... |

Re: Count the length on a numberAre you looking for and API or just logic.
I would use the following logic I would divide it by 10 and store it in a integer and if its greater than 10 repeat the process and increase the length of the number As an example 1234 / 10 = 123 Length = Loop var = 1 123 / 10 = 12 Length = Loop var = 2 12 / 10 = 1 Length = Loop var = 3 1 / 10 = 0 Length = Loop var = 4 |

All times are GMT +5.5. The time now is 16:14. |