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

Is there any data type in c with variable size?

0 Answers  


What are dangling pointers? How are dangling pointers different from memory leaks?

1 Answers  


Can a local variable be volatile in c?

0 Answers  


what is ur strangth & weekness

0 Answers   Cognizant, LG Soft, NetEnrich,


What is NULL pointer?

0 Answers   Infosys,


why in C,C++'s int size is 2 byte and .net(c#) int Size is 4 byte?

2 Answers  


I have an array of 100 elements. Each element contains some text. i want to: append a star character to the end of every fifth element remove every second character from every tenth element, and… add a line feed (ascii 10) after the 30th character of every array element whose length is greater than 30 characters.

1 Answers  


Can you write the algorithm for Queue?

0 Answers   College School Exams Tests, TCS,


What is 02d in c?

0 Answers  


Write a C++ program to generate 10 integer numbers between - 1000 and 1000, then store the summation of the odd positive numbers in variable call it sum_pos, then find the maximum digit in this variable regardless of its digits length.

0 Answers  


FIND THE OUTPUT IF THE INPUT IS 5 5.75 void main() { int i=1; float f=2.25; scanf("%d%f",&i,&f); printf("%d %f",,i,f); } ANSWER IS 5 AND 2.25 WHY?

4 Answers   Wipro,


Write a program to check whether a number is prime or not using c?

0 Answers  


Categories