Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

with the main .c file ----------------------------------------- #include #includ

ID: 3623530 • Letter: W

Question

with the main .c file
-----------------------------------------
#include
#include "is_prime.c"
#include "primes.h"
int main(void)

{
int f,result,n=2,cnt;
printf("PRIME NUMBERS WILL BE PRINTED. ");
printf("How many prime number do you want to see? ");
scanf("%d", &f);
do{
if (is_prime==1)
{is_prime(n);
printf(" %3d:%6d", n);}
else
n++,cnt++;
}while (cnt<=f);
return 0;
}
--------------------------------------
and is_prime.c is
____________________________
#include "primes.h"
int is_prime(int n)
{
int k, limit;

if (n == 2)
return 1;
if (n % 2 == 0)
return 0;
limit = n / 2;
for (k = 3; k <= limit; k +=2)
if (n % k ==0)
return 0;
return 1;
}
____________________________
and
primes.h is

#include
#include

int is_prime(int n);

Explanation / Answer

please rate - thanks

corrections to main are in red

#include <stdio.h>
#include<conio.h>
int is_prime(int n);

int main(void)

{
int f,result,n=2,cnt=1;
printf("PRIME NUMBERS WILL BE PRINTED. ");
printf("How many prime number do you want to see? ");
scanf("%d", &f);
do
{if(is_prime(n)==1)
    {printf(" %3d:%6d",cnt, n);
     cnt++;
     }
n++;
}while (cnt<=f);
return 0;
}