0 이 입력될 때까지 정수를 계속 입력받아 3의 배수와 5의 배수를 제외한 수들의 개수를 출력하는 프로그램을 작성하시오.
1 2 3 4 5 6 7 8 9 10 0
5
package com.jungol.algorithm079;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int count = 0;
while(true) {
int number = scanner.nextInt();
if(number % 3 != 0 && number % 5 !=0) {
count++;
}else if(number == 0) {
break;
}
}
System.out.print(count);
scanner.close();
}
}