answersLogoWhite

0


Best Answer

#include<iostream.h>

#include<conio.h>

#include<math.h>

void main()

{

int i,j;

clrscr();

for(i=3;i<=1000;i++)

{

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

{

if(i%j==0)

break;

}

if(i==j)

cout<<j<<"\t";

}

getch();

}

//try it by apurba sinus

User Avatar

Wiki User

13y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How do you write a program in c plus plus which accepts a number from the user and generate prime number till that number?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Shell program to generate prime number between 1 and 50?

There are several shell programs available for download on the Internet that will generate prime numbers. The best way to find a prime number is through calculation, however.


With a given big integer number which is the product of two prime numbers how do you find them?

First write a program to generate the prime number. After one prime number was generated, divide the big int number by the prime number. If the remainder is zero then quotient is the second prime number ( also it is important to check whether the quotient is prime number or not because sometimes you will get wrong answer). Repeat the process until you get the result.


Shell program to generate the prime numbers betwee 1 to 50?

2,3,5,7,9,11,13,17,19,23,29,31,37,39,41,43,47,49


Find a prime number that if multiplied would generate a 400 digit number?

The answer is vague but correct . Take any prime number and any other number whose combined digit length is 401 and their product will generate a 400 or a 401 digit number.


What is a C program to generate prime no?

not sure of the exact syntax but its quite hard to generate them, but you can go through a list of numbers, that could be 0-10000000 say, and check if it is prime by dividing it by all the numbers that are smaller than it


A program to find that the input number is prime or not?

Use Wolfram|Alpha... go to the related link below, Wolfram|Alpha, and type in (is __ (number) prime) and then the program will compute that and tell you if it is prime or composite.


What is the generic formula to generate prime number?

any number that can only be divided by 2 numbers itself and 1


Program for print prime all number from 1 to 100 in foxpro?

Prime numbers are numbers that are only divisible by themselves and the number 1. You can write a program to print all prime numbers from 1 to 100 in FoxPro.


Does the CIA buy prime numbers?

I see no reason why they would do that. Prime numbers can be used for encryption, but there are algorithms that can quickly generate a more or less random prime number. No need to pay for the "discovery" of a specific number!


What are prime?

A prime number is a number that cannot be generated by multiplying any 2 whole numbers (aside from 1 and itself). For example, 8 is not a prime number because you can get it by multiplying 4X2. 7 on the other hand IS a prime number because there are no whole numbers you can multiply to generate it aside from 1X7.


What is the largest prime no that is stored in 8 bit pattern?

Write your own prime number program and find out.


What is the code of a c program that will read in a positive integer value and determine If the integer is a prime number and If the integer is a Fibonacci number?

see the program