import java.util.*;
class odd
{
void main()
{
Scanner ob=new Scanner(System.in);
int a[]=new int [5];
int i,c,j;
System.out.println("Enter 5 nos");
for(i=0;i<5;i++)
{
a[i]=ob.nextInt();
}
for(i=0;i<5;i++)
{
c=0;
for(j=1;j<=a[i];j++)
{
if(a[i]%j==0)
c++;
}
if(c==2)
a[i]=0;
}
System.out.println("Modified array is");
for(i=0;i<5;i++)
System.out.println(a[i]);
}
}
It looks like you're using an ad blocker. We rely on ads to keep our site free, please whitelist us!
Click here to continue
Please whitelist our site to continue enjoying our content.
Whitelist | Close