Community Sites
Create your own community website and start earning today !
It's Free !
 
Communities Members BookmarksPolls Fresher Jobs Funny Photos B.Tech Projects New Member FAQ  



My Profile
Active Members
TodayLast 7 Days more...



Awards & Gifts
Online Exams

Fresher Jobs


Our fresher job section is exclusively for fresh graduates! Find jobs for freshers in major Indian cities including Bangalore, Chennai, Hyderabad, Pune or Kochi

Resources


Find educational articles, blogs, discussion threads and other resources.

Colleges


Find details about any college in India or search for courses.

website counter



JAVA code to find prime numbers in the array


Posted Date: 15 Aug 2008    Resource Type: Articles/Knowledge Sharing    Category: Computer & Technology

Posted By: Rahul Jain       Member Level: Gold
Rating:     Points: 2



import java.util.Scanner;
class arrays4
{
public static void main (String args[])
{
Scanner o=new Scanner(System.in);
int a[]=new int[10];
int b=0,t=0,p=0;
System.out.println("Enter the array :");
for (int i=0;i<10;i++)
{
a[i]=o.nextInt();
}
for(int l=0;l<10;l++)
{
if (a[l]==1 && a[l]==2)
{
b++;
continue;
}
else
{
int f=a[l];
for(int m=2;m{
int k=f%m;
if (k==0)
{
t++;
}
}
if(t==0)
{
b++;
}
}
}
System.out.println("no of prime numbers in the array:"+b);

}
}




Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Prime nos.  .  

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: JAVA code to store 1 to 10 then 10 to 1
Previous Resource: JAVA code to find the average marks
Return to Discussion Resource Index
Post New Resource
Category: Computer & Technology


Post resources and earn money!
 
Related Resources

Watch TV Channels



Contact Us    Editors    Privacy Policy    Terms Of Use   

SpiderWorks Technologies Pvt Ltd. 2006 - 2007 All Rights Reserved.