Miti059

10. number of digits

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