MyaZ 2020. 1. 25. 21:38

 

Scanner sc = new Scanner(System.in);
		System.out.println("1부터 99중에서 하나의 수를 입력해주세요");
		int num = sc.nextInt();

		
			int tenth = num / 10;
			int first = num - (tenth * 10);
			
			/*num    6    13   69
			  tenth  0    1    6
			  		  ㄴ0.6 / 1.3 / 6.9 이지만 실수만 표시
			  first  6    3    9
			*/

			
			
			if (num < 10) {
				if (first % 3 == 0)//나누기 3했을떄 남는 수가 0과 같다
					System.out.println("박수짝");
			}

			else if (num > 10) {
				if (tenth % 3 == 0) {
					if (first % 3 != 0)
						System.out.println("박수짝");
					if (first % 3 == 0)
						System.out.println("박수짝짝");
				}

				else if (first % 3 == 0)
					System.out.println("박수짝");
			}

			sc.close();