answersLogoWhite

0


Best Answer

#include <stdio.h>

int main () {

int n, i, j, k;

printf ("2 ");

for (i=3,n=2; n<=50; i+=2) {

for (j=3,k=1; j<i-1; j+=2) {

if (i % j 1) {

printf ("%d ", i);

n++;

}

}

printf("\n");

return 0;

}

User Avatar

Wiki User

14y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: C program to generate the first 50 prime 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.


Which is the first prime number?

2 is the first prime number.


What is the first prime number after 14?

The first prime number after 14 is 17.


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 first prime number after 30?

The first prime number after 30 is 31


What is the first prime number after 8?

The first prime number after 8 is 11


The first prime number is after 50?

The first prime number after 50 is 53.


What is the first prime number after 44?

The first prime number after 44 is 47.