ok i got it. Here is my code. There are only a few little problems in it. Say the user enters 100, the prime numbers stop at 100, but i want 100 primes printed. It also prints 1.

Code:

/**************************************************
Filename: pgen.c
Author: Mike Hartwig
Purpouse: Generate given amount of prime numbers.
Input: Keyboard
Output: Screen
***************************************************/
#include <stdio.h>
#include <stdlib.h>
int main ()
{
int prime_amount; //the amount of primes to generate.
int prime_count = 1;
int prime_answer; // the answer.
printf("Welcome to the Prime Number Generator.\n");
printf("How many prime numbers would you like to generate: ");
scanf("%d", &prime_amount);
printf("Generating %d prime numbers...\n",
prime_amount);
printf("2, 3, 5, 7 ");
do
{
prime_answer = prime_count++;
if(prime_answer % 2 != 0 && prime_answer % 3 != 0 && prime_answer % 5 != 0 && prime_answer % 7 != 0)
{
printf("%d, ", prime_answer);
}
}
while (prime_count < prime_amount);
return (0);
}