Program to find the length of a number in c and cplusplus (cpp)

Program to find the length of a number in c and C plus plus (cpp)

Suppose the number is 5698, then we can find the length of this number by logic as;

  1. Divide the number with 10, and the result will be 5698/10 = 570
  2. Divide the 570 with 10, and the result will be 570/10 = 57
  3. Divide the 57 with 10, and the result will be 57/10 = 6
  4. Divide the 6 with 10. and the result will be 6/10 = 0

Congratulations: You successfully find the length of the number. Similarly, you can find the length of any number.

Flowchart to find the length of a number

length of a number in c and cplusplus (cpp)
          Figure: length of a number.

Program to find the length of a number in C++ (CPP)

 

With Comments – Program to find the length of a number in C++ (CPP)

Output:

length of a number in c output
Figure: length of a number.

Program to find the length of a number in C

With Comments – Program to find the length of a number in C++ (CPP)

 

Fazal Rehman Shamil
Welcome to all friends. The reason for our success is only your love for T4Tutorials. Our team is always available to answer your queries regarding any kind of confusions or discussion regarding your study and career matters. For discussion with us please join our facebook group "T4Tutorials.com". The link of the group is mentioned below. Thanks and love to all for connecting with us. We are nothing without you. Love you all.....
https://web.facebook.com/groups/2066136233601097/