Mim527

10.count number of digits

May 31st, 2019
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.24 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main()
  4. {
  5.     int num,total=0;
  6.  
  7.  
  8.     printf("Enter any number: ");
  9.     scanf("%d",&num);
  10.  
  11.     while(num!= 0)
  12.     { total++;
  13.        num=num/10;
  14.     }
  15.  
  16.     printf("Total digits: %d",total);
  17.  
  18.     return 0;
  19.     }
Advertisement
Add Comment
Please, Sign In to add comment