C Program to Count Number of Digits in an Integer

In this tutorial, we will see simple c program to count number of digits in an number.
For example:
If input number is 564 then count of digits will be 3

Output:

Enter an integer: 567
Number of digits: 3

In this program, we are reversing number as follow:

  • First iterationnum = 567 ,digitsCount=0
  • second iterationnum = 56 ,digitsCount=1
  • First iterationnum = 5 ,digitsCount=2
  • First iterationnum = 0 ,digitsCount=3
  • Program will exit as num became 0

That’s all about C program to Count Number of Digits in an Integer.

Leave a Reply

Your email address will not be published. Required fields are marked *