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



Write a program to print the following series 2 5 11 17 23 31 41 47 59 .....

Answer / riya

2 5 9 13 17 23 31

Is This Answer Correct ?    18 Yes 16 No

Write a program to print the following series 2 5 11 17 23 31 41 47 59 .....

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

Post New Answer

More C Interview Questions

i want explaination about the program and its stack reprasetaion fibbo(int n) { if(n==1 or n==0) return n; else return fibbo(n-1)+fibbo(n-2); } main() { fibbo(6); }

2 Answers  


any string of bits of length 'n' represents a unique non- negative integer between.............?

2 Answers  


what is the similarities between. system call and library function?

1 Answers   Wipro,


Write a programme to find even numbers without using any conditional statement?

3 Answers   ADD Software, Infosys,


What is a floating point in c?

1 Answers  


If you know then define #pragma?

1 Answers  


which operator having highest precedence? a.)+ b.)++ c.)= d.)%

4 Answers  


Is c programming hard?

1 Answers  


fn f(x) { if(x<=0) return; else f(x-1)+x; }

5 Answers   HCL,


What is the process to generate random numbers in c programming language?

1 Answers  


how to write a c program to print list of fruits in alpabetical order?

1 Answers  


Write a program to print fibonacci series using recursion?

1 Answers  


Categories