1 ~ 100 까지 숫자중 짝수만 출력
( Example_ Outputs only even numbers from 1 to 100 )

 

public class print_only_even_numbers {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		
		long resultVal = 0;
		for (int i=1; i<=100; i++)
		{
			resultVal = i % 2;
			if(resultVal == 0)
			{
				System.out.println( i + " 는 짝수 입니다.");
			}
		}
	}

}