answersLogoWhite

0

import java.io.*;

public class pmn {

public static void main(String[] args) throws Exception{

int i;

BufferedReader bf = new BufferedReader(

new InputStreamReader(System.in));

System.out.println("Enter number:");

int num = Integer.parseInt(bf.readLine());

System.out.println("Prime number: ");

for (i=1; i < num; i++ ){

int j;

for (j=2; j<i; j++){

int n = i%j;

if (n==0){

break;

}

}

if(i == j){

System.out.print(" "+i);

}

}

}

}

User Avatar

Wiki User

12y ago

What else can I help you with?

Related Questions

How do you write a VBnet program to find the prime numbers between 100 to 200?

VBnet program to find the prime numbers between 100 to 200?


How do you write a program in objective c numbers 1-100 prime numbers?

fdsgfhgdfhgdf


Write a C program to find the sum of all prime numbers?

Since there is an infinite set of prime numbers the answer would be infinity.


How many prime numbers between 1 and 8888888888888888888888888888888888888888888888?

To determine the number of prime numbers between 1 and 8888888888888888888888888888888888888888888888, we can use the Prime Number Theorem. This theorem states that the density of prime numbers around a large number n is approximately 1/ln(n). Therefore, the number of prime numbers between 1 and 8888888888888888888888888888888888888888888888 can be estimated by dividing ln(8888888888888888888888888888888888888888888888) by ln(2), which gives approximately 1.33 x 10^27 prime numbers.


How do you write a C plus plus program that will display the first 10 positive prime numbers?

By learning how to program on C+.


Prime numbers between 1 to 10 in microprocessor 8085?

program to find prime number in 8085 microprocessor


How can I write a program to display prime numbers from 1 to 100?

Write a function that implements an algorithm that checks to see if a particular integer is prime (returning a boolean). Write a program that uses that function on each number from 1 to 100, and if true, displays that number.


How do you write a Program of printing prime numbers between 1 to 100 in 1 statement only?

You really need some nested loops; but some programming languages might allow you to write this as one statement.


Write a program to print first 100 alternative prime numbers?

This would require some computer knowledge. It can make it easier to find out the prime numbers without figuring it out in your head.


Write all the prime numbers between 35 to 45?

37, 41, and 43


How do you write a c program to get a range from user and give a list of prime numbers?

To get all tutorials of "c programming" Reference:cprogramming-bd.com/c_page2.aspx# prime number


What is the product of the prime numbers between 29 and 30?

29 is a prime number. There are no prime numbers between 29 and 30.