코딩테스트
자릿 수 출력
wtdsoul
2024. 9. 16. 19:20
#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;
}