Series

14. Program

How to Print this series ? Numbers which divide by 7 gives 0 reminder and when divide by 2, 3, 4, 5, 6 gives 1 reminder ? Like .... 301, 701

import java.util.Scanner; class S { public static void main(String args[]) { System.out.println("How much numbers do you want ?"); Scanner sc = new Scanner(System.in); int num = sc.nextInt(); int i , j = 1; if(num!=0) { for(i=7 ; j<=num ; i++ ) { if(i%7==0 && i%2==1 && i%3==1 && i%4==1 && i%5==1 && i%6==1) { System.out.print(i + " "); j++; } } } else { System.out.print("Number must be greater then 0 : "); } } }