Can someone help me write a C program that will read in positive integers and determine if each integer is a prime number or not. Do so the brute force way by testing for divisors between 1 and the number and if exactly two divisors are found, then the number is prime. Your main program must call a function IsPrime. The function IsPrime returns either a 0 or a 1. It does not return the number of the divisors. In so doing, your program should read in positive integers from a file. The name of the file is given on the command line via argv[1]. You should read in the numbers until EOF is reached as you do not know the precise number of numbers in the file.
Explanation / Answer
#include #include #define MAX 1000 int isPrime(int n) { int i; for(i=2; i