Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


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

How to find the usage of memory in a c program

1 Answers   Infosys,


Why doesnt long int work?

0 Answers  


What is the explanation for cyclic nature of data types in c?

0 Answers  


PLS U SENS ME INTERVIEW O. MY EMAIL ADD, SOFIYA.SINGH@GMAIL.COM

0 Answers  


Can we access array using pointer in c language?

0 Answers  


How do c compilers work?

0 Answers  


Explain bit masking in c?

0 Answers  


What is a pragma?

0 Answers  


what is the most appropriate way to write a multi-statement macro?

1 Answers  


Which of the Following will define a type NODE that is a node in a Linked list? A)struct node {NODE*next;int x;};type def struct node NODE; B)typedef struct NODE {struct NODE *next;int x;}; C)typedef struct NODE {NODE *next;int x;}; D)typedef struct {NODE *next;int x;}NODE;

5 Answers   Accenture, TCS,


What is class and object in c?

0 Answers  


What does the error 'Null Pointer Assignment' mean and what causes this error?

0 Answers   TISL,


Categories