Preview:
import java.util.Scanner;
public class Abid {
	public static void main (String [] args){
		Scanner input = new Scanner(System.in);
		System.out.print("Enter End no. : ");
		int endNum = input.nextInt();
		int countSP=0;
		String spNum = "Following are special: ";
		
		for(int i=1; i<=endNum; i++){
			if (i%2==0&&i%3==0&&i%7!=0){
				countSP++;
				spNum = spNum + i +",";
			}
		}
		System.out.println("Special Number Count: "+countSP);
		System.out.println(spNum);		
	}
}
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter