SAADQUAMER

Digits counter

Jun 8th, 2019
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.25 KB | None | 0 0
  1. // C program to count number of digits in a number
  2. #include<stdio.h>
  3. int main(){
  4. int count=0,n;
  5. printf("ENTER A NUMBER : ");
  6. scanf("%d",&n);
  7. while(n != 0){
  8.     n=n/10;
  9.     count++;
  10. }
  11. printf("NUMBER OF DIGIT IS : %d\n",count);
  12.  
  13.  
  14.  
  15. return 0;
  16. }
Advertisement
Add Comment
Please, Sign In to add comment