Ok I got this finally. It works.
Code:
/**************************************************
Filename: main.c
Author: Mike Hartwig
Purpouse: Generate given amount of prime numbers.
Input: Keyboard
Output: Screen
***************************************************/
#include <stdio.h> /* Pre-processor */
#include <math.h> /* Directives */
int main ()
{
int x = 0; //the loop variable
int y = 0; //the prime amount variable
int y_prim = 0; //the answer
printf("Welcome to the Prime Number Generator.\n");
printf("How Many Primes To Generate: ");
scanf("%d", &y ); //How many primes to generate
do
{
x++; //increment x
while (y_prim < 1000000)
{
y_prim++; //increment y_prim
if ((y_prim % 2 != 0 || y_prim == 2) && (y_prim % 3 != 0 || y_prim == 3) && (y_prim % 5 != 0 || y_prim == 5) && (y_prim % 7 != 0 || y_prim == 7) && y_prim != 1) //filter out multiples of 2, 3, 5, & 7
{
printf("%d ", y_prim);
break; //break, and go to outer loop
}
else
{
continue;
}
}
} while (x < y); //
return (0);// all done
}