I need help on modifying this code to able to compare them withrespect to the nu
ID: 3616242 • Letter: I
Question
I need help on modifying this code to able to compare them withrespect to the number of steps it takes (number of iterations).Example below:Printing all the numbers like below
2 3 4 5 6 7 8 9 10 11 12
13 14 15 16 17 18 19 20
21 22 23 24 25 26 27 28
29 30 31 32 33 34 35 36
then it can print the prime numbers like below:
2 3 5 7 9 11 13 17 19
23 29 31 37
#include<stdio.h>
#include<conio.h>
int main(void)
{
int i, n = 1;
int k = 1;
printf("Prime numbersbtw 2 to 3000 are: ");
while(n <= 3000)
{
i = 2;
while(i < n)
{
if(n % i == 0)
break;
else
i++;
}
if(i == n)
{
printf("%6d", n);
k++;
if(k%12==0)
printf(" ");
}
n++;
}
getch();
}
Explanation / Answer
please rate - thanks #include #include int main() { int i,j,max=3000; int sieve[3000]; for(i=0;iRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.