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
Is the exit() function same as the return statement? Explain.
Q.1 write a program to create binary tree 1 to 16 numbers? Q.2 write a program to creat a binary search tree for the member that is given by user?
Explain the priority queues?
Differentiate between full, complete & perfect binary trees.
typedef enum { html, java, javascript, perl, cgi } lang;The above statement defines a : a) Union b) User defined type c) Enumerated variable d) none
Explain how does flowchart help in writing a program?
There seem to be a few missing operators ..
write a programe to accept any two number and check the following condition using goto state ment.if a>b,print a & find whether it is even or odd and then print.and a
Explain that why C is procedural?
How macro execution is faster than function ?
What is the use of pragma in embedded c?
Once I have used freopen, how can I get the original stdout (or stdin) back?
Create a structure to specify data on students given below: Roll number, Name, Department, Course, Year of joining Assume that there are not more than 450 students in the college. 1.write a function to print names of all students who joined in a particular year 2.write a function to print the data of a student whose roll number is given
What is the purpose of clrscr () printf () and getch ()?
c programs are converted into machine language with the help of a) an interpreter b) a compiler c) an operatinf system d) none of the above