public class Main { public static void main(String args[]) { int x,n=20; for(x=1;x<=n;x++) { if((x%2==0 && x%3==0)) { break; } System.out.print(x); } } }
1
2
3
4
5
public class Main { public static void main(String args[]) { int x,n; n=Integer.parseInt(args[0]); for(x=1;x<=n;x++) { if((x%2==0 && x%3==0)) { break; } System.out.print(x); } } }
1
2
3
4
5
import java.util.*; public class Main { public static void main(String args[]) { int x,n; Scanner s=new Scanner(System.in); System.out.println("Enter n value : "); n=s.nextInt(); for(x=1;x<=n;x++) { if(!(x%2==0 && x%3==0)) { brek; } System.out.print(x); } } }
Enter n value : 20
1
2
3
4
5