Advertisement
nguyenhappy92

Đếm xem số tự nhiên n có bao nhiêu chữ số

Oct 16th, 2015
325
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.22 KB | None | 0 0
  1. // Dem so co bao nhieu chu so
  2. // Khai bao cac ham thu vien neu co
  3. #include<stdio.h>
  4. #include<conio.h>
  5.  
  6. void main()
  7. {
  8. int n;
  9. scanf("%d",&n);
  10. int dem=0;
  11. while(n!=0)
  12. {
  13. n=n/10;
  14. dem++;
  15. }
  16. printf("%d\n",dem);
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement