prime number program with function

hi all, this is the next one i picked to do.

-Finding Prime Numbers and Sum-

An Integer is said to be prime if it is divisible by only 1 and itself. For example 2, 3, 5 and 7 are prime, but 4, 6, 8, and 9 are not.

Write a program to determine which numbers between 1 and 1000 and prime.

Use a function called primeNum to do the work.

The prototype should look like the following:

int primeNum (int); The function should see if the value passed in is prime. If the value is prime, the function should return 1. If the value is not prime, then the function should return 0. There should be no printfs in the function.

Your main program should then print out the number if it is prime.

Your main program should also print out the sum of all the prime numbers from 1 to 1000.

Here’s the sample output:

Prime Numbers are: 2,3,5,7,…….

Sum of Prime Numbers from 1 to 1000: xxxx.

Hint: Remember the % operator can tell you if a number is divisible by itself.

i am totally lost in what im trying to do, and this is all ive come up with so far. Am I going about it the right way, passing the correct int to the function and the work with % to find the prime number. I have no idea how to use that to find a prime number so I just took a guess. Thanks for the help again I know im putting up more than my share up here but I'm trying to get better.

Code:

`#include <stdio.h>`

#include <stdlib.h>

#define MAX 1000;

int main() {

int primeNum (int);

int i;

for (i = 0; i <= MAX; i++) {

printf("Prime numbers are: %d",prime(i);}

}

system("PAUSE");

return 0;

}

int primeNum (int i) {

if (i % i == 0){

return 1;

}

else {

return 0;

}

}