728x90
반응형
문제 : https://codeup.kr/problem.php?id=1278
문제 설명
어떤 숫자가 입력되면 그 숫자가 몇 자릿수 숫자인지 알아내는 프로그램을 작성하시오.
예)
7 ----> 1 (1자릿수)
10 ----> 2 (2자릿수)
4322 ----> 4 (4자릿수)
# include <stdio.h>
int main()
{
int n,count=0;
scanf("%d",&n);
while(n!=0)
{
n = n/10;
count++;
}
printf("%d",count);
return 0;
}
728x90
반응형
최근댓글