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 |
Find Error if any in below code, Justify ur answer: struct xx { int a; struct yy { char c; struct xx* p; } struct yy* q; }
Explain in detail how strset (string handling function works )pls explain it with an example.
When we use void main and int main?
What are the two types of structure?
how to write a prog in c to convert decimal number into binary by using recursen function,
One of the Institutes contains 5 student groups. Every group contains 4 students. Institute wants to store student group’s details in array. Group should contain group member’s details (name and registration number and age), project name, and mark of the group.
What is I ++ in c programming?
What does *p++ do?
f(x,y,z) { y = y+1; z = z+x; } main() { int a,b; a = 2 b = 2; f(a+b,a,a); print a; } what is the value of 'a' printed
What are the advantages of Macro over function?
Suggesting that there can be 62 seconds in a minute?
how can f be used for both float and double arguments in printf? Are not they different types?