나는 스캐너 테스트를 만들고 있습니다. 나는 짝수 1-50을 인쇄 할 수 있었다. 나는 사용자가 8을 입력 할 때 8-50에서 모든 짝수를 인쇄 할 수 있도록 스캐너 코드를 원한다.짝수 스캐너 코드
import java.util.Scanner;
공용 클래스 ModulusCalculation {
public static void main(String[] args)
{
int endLimit = 50;
System.out.println("WE ARE GOING TO PRINT EVEN NUMBER FROM 1 AND " + endLimit);
Scanner input = new Scanner(System.in);
for (int startingPoint = 1; startingPoint <= endLimit; startingPoint++)
{
if (startingPoint % 2 == 0)
{
input.nextLine();
System.out.println(+startingPoint);
}
}
}
}
글쎄요. 나는 그 순간에 작업을 마치려고하고 있습니다. 단지 1-50/모든 값을 반환 할 때만 인쇄 할 것입니다. 정품을 무례하고 도움을 청하려고 애 쓰고 –