#include <iostream>
#include <stdio.h>
#include <string.h>
#include <math.h>
int digit(int n) {
if(n < 10) return 1;
else if(n < 100) return 2;
else if(n < 1000) return 3;
else if(n < 10000) return 4;
}
int main(){
int n, i, a;
scanf("%d", &n);
printf("%d\n", digit(n)); // 자릿수를 구해주는 함수
return 0;
}

'코딩테스트' 카테고리의 다른 글
| 성적표 (0) | 2024.09.16 |
|---|---|
| 배열의 최소값 리턴 (0) | 2024.09.16 |
| 소수 찾기 (0) | 2024.09.16 |
| 별 찍기 (점차 아래로 증가) (0) | 2024.09.16 |
| 방 배정 (종올 기출 중등부) (3) | 2024.09.16 |