💻 하나씩 차곡차곡/자료구조 & 알고리즘(JAVA)
2자리 양수만 입력받기 (chap01/Twodigits)
뚜루리
2022. 10. 12. 19:54
728x90
320x100
package chap01;
import java.util.Scanner;
public class TwoDigits {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int no;
System.out.println("2자리 양수를 입력하세요.");
do{
System.out.print("no값 : ");
no = scan.nextInt();
}while(no < 10 || no > 99);
System.out.println("변수 no값은 " + no + "이 되었습니다.");
}
}
논리연산을 활용함.
728x90
320x100