import java.util.*;
class EvenNumAlter
{
public static void main(String[] args)
{
int n,count=0;
Scanner sn=new Scanner(System.in);
System.out.println("Enter The Number::");
n=sn.nextInt();
for(int i=1;i<=n;i++)
{
if(i%2==0)
{
count=count+1;
if(count%2!=0)
System.out.println(i);
}
}
}
}
class Fibonacci
{
public static void main(String[] args)
{
int prev,next,sum,n;
prev=next=1;
sum=0;
for(n=1;n<=10;n++)
{
System.out.println(prev);
sum=prev+next;
prev=next;
next=sum;
}
}
}
Program for Check the Given Num Prime Or NOT::
class PrimeNo
{
public static void main(String[] args)
{
int num=Integer.parseInt(args[0]);
int flag=0;
" for(int i=2;i<=num;i++)>
{
if(num%i==0)
{
System.out.println(num+" is not a prime num");
flag=1;
break;
}
}
if(flag==0)
{
System.out.println(num+" is a prime num");
}
}
}
Program for Find the Prime Numbers up to Given Number:
import java.util.*;
class PrimeNum2
{
public static void main(String[] args)
{
int i,j,s=0,d=0;
int n;
Scanner sn=new Scanner(System.in);
System.out.println("Enter the Number YOu Want::");
n=sn.nextInt();
"for(i=1;i<=n;i++)">
{
s=0;
"for(j=1;j<=i;j++)"
{
if(i%j==0)
s=s+1;
}
if(s==2)
{
System.out.println(i);
d=d+1;
}
}
System.out.println("The Number Of Prime Numbers Are==:"+d);
}
}
Program for Find the AlterNative Prime Numbers up to Given Number:
import java.util.*;
class PrimeNum2
{
public static void main(String[] args)
{
int i,j,s=0,d=0;
int n;
Scanner sn=new Scanner(System.in);
System.out.println("Enter the Number YOu Want::");
n=sn.nextInt();
System.out.println("AlterNative Prime NUmber:");
"for(i=1;i<=n;i++)">
{
s=0;
"for(j=1;j<=i;j++)"
{
if(i%j==0)
s=s+1;
}
if(s==2)
{
d=d+1;
if(d%2==0)
System.out.println(i);
}
}
System.out.println("The Number Of Prime Numbers Are==:"+d);
}
}