/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package primenumber;
/**
*
* @author mcmanuel
*/
public class PrimeNumber {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
int num, a, b, c;
num = 10;
for(a = 1; a <= num; a++)
{
b = 0;
for(c = 2; c <= a/2; c++)
{
if(a%c == 0)
{
b = b + 1;
}
if(c == 0)
{
System.out.println("The prime number is" + a);
}
}
}
}
}
mcmanuel20 0 Newbie Poster
JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster
mcmanuel20 0 Newbie Poster
jalpesh_007 -3 Newbie Poster
mLearning 0 Newbie Poster
Taywin 312 Posting Virtuoso
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.