// Note: Java
program is built on NetBeans IDE 8.2. OS Windows 8 or Windows 10.
//
This is a sample of the simple programming in Java for
beginners.
//--------------------------------------------------------------------------------------------------------
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package primenumbers1.pkg100;
/**
*
* @author TSL
*/
public class Primenumbers1100
{
/**
* @param args the command line arguments
*/
public static void main(String[] args)
{
// TODO code application logic here
int i, j;
int limit = 1000;
boolean isPrime = true;
System.out.println("Prime numbers 1 between and " + limit);
for(i=1; i<limit; i++)
{
isPrime = true;
for(j=2; j<i; j++)
{
if(i%j==0)
{
isPrime = false;
break;
}
}
if(isPrime)
System.out.print(i + " ");
}
}
}
No comments:
Post a Comment