#include<stdio.h>
#include<stdbool.h>
#include<conio.h>
#include<math.h>
#include<string.h>
//đếm số lượng chữ số của số nguyên dương
void main()
{
int n;
int i;
int count = 0;
printf("enter number: ");
scanf("%d", &n);
for(i = 1; i <= n; i++)
{
count++;
n = n/10;
}
printf("entered number has %d digits", count+1);
getch();
}
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter