자릿수 구하기

황희윤·2023년 9월 12일

자릿수 구하기

양의 정수만 입력한다는 가정 하에

public static void main(String[] args){
	Scanner stdIn = new Scanner(System.in);
    int no;
    int n = stdIn.nextInt();
    
    while(n>=1){
    	n = n/10;
        no++;
    }
    
    System.out.print("result : "+no);
}
profile
HeeYun's programming study

0개의 댓글