Write a program to print the following series
2 5 11 17 23 31 41 47 59 ...
Answers were Sorted based on User's Feedback
Answer / dixit
#include<stdio.h>
int main()
{
int i=0,j=0,c=0,ct=-1,n=0;
scanf("%d",&n);
printf("2 ");
for(i=4;i<100;i++)
{ c=1;
for(j=2;j<=i/2;j++)
{
if(i%j==0) c=0;
}
if(c!=0){ ct++;
if(ct%2==0 && n>1 ) {
printf("%d ",i);
n--;
}
}}
return 0;
}
Is This Answer Correct ? | 8 Yes | 20 No |
what is the advantage of software development
Explain why c is faster than c++?
Write the program that calculates and prints the average of several integers. Assume that the last value read is sentinel 9999.
What is #error and use of it?
AMMONG THE 4 STROAGE CLASSES IN C, WHICH ONE FASTEST?
what is the different between if-else and switch statment (other than syntax)
26 Answers CTS, Oracle, Scorpos,
const char * char * const What is the differnce between the above tow?.
Which one would you prefer - a macro or a function?
Explain 'bus error'?
what is the associativity of bitwise OR operator?
how to TOGGLE Nth bit of variable in a MACRO
What is the process to create increment and decrement stamen in c?