Write a program to print the following series
2 5 11 17 23 31 41 47 59 ...
Answer Posted / 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 |
Post New Answer View All Answers
Write a program to swap two numbers without using a temporary variable?
What is modifier & how many types of modifiers available in c?
How can you determine the size of an allocated portion of memory?
Are c and c++ the same?
Is main a keyword in c?
Why double pointer is used in c?
Explain how can I convert a string to a number?
which of the following is not a character constant a) 'thank you' b) 'enter values of p, n ,r' c) '23.56E-o3' d) all of the above
Why c is known as a mother language?
What do you understand by normalization of pointers?
What was noalias and what ever happened to it?
Is there any possibility to create customized header file with c programming language?
What is difference between stdio h and conio h?
What are data structures in c and how to use them?
What are linked lists in c?