Prime Numbers Till N!
Written Code!! import java.util.Scanner; public class Main{ public static int is_prime(int num){ if(num

Written Code!!
import java.util.Scanner;
public class Main{
public static int is_prime(int num){
if(num<=0){
return 0;
}
if(num==1){
return 0;
}
for(int i = 2;i<=num/2;i++){
if(num%2==0){
return 0;
}
}
System.out.println(num);
return 1;
}
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
System.out.println("Enter the Number:");
int n = sc.nextInt();
System.out.println();
for(int i = 1;i<=n;i++){
is_prime(i);
}
}
}