#include <stdio.h> #include <ctype.h> int prime(int n) { int a; for (a=2;a<=n;a+
ID: 3650784 • Letter: #
Question
#include <stdio.h>#include <ctype.h>
int prime(int n)
{
int a;
for (a=2;a<=n;a++)
{
if(n%a==0 && n!=a)
{
return 0;
}
}
return 1;
}
int main()
{
int num,i,count;
printf("Enter number:");
scanf("%d", &num);
printf("First 100 Prime Numbers starting with number entered if prime: ");
printf("Otherwise it will start at next available prime number: ");
for( i=num, count=0;count<100;i++)
{
if(prime(i)==1)
{
printf("%d ", i);
count++;
if(count%10==0){
printf(" ");}
}
}
return 0;
}
Explanation / Answer
itz showing prime numbers that are less than 100 and not 100 prime numbers
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.