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 ...

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


Please Help Members By Posting Answers For Below Questions

What is the use of the function in c?

973


What is variables in c?

985


How can variables be characterized?

2132


Is it better to bitshift a value than to multiply by 2?

1053


What is the use of static variable in c?

1046


Give differences between - new and malloc() , delete and free() ?

1049


What is the equivalent code of the following statement in WHILE LOOP format?

1251


What is class and object in c?

1051


List the difference between a 'copy constructor' and a 'assignment operator' in C?

1036


a parameter passed between a calling program and a called program a) variable b) constant c) argument d) all of the above

1072


Explain how can a program be made to print the line number where an error occurs?

1152


Explain the use of keyword 'register' with respect to variables.

973


How can you find the day of the week given the date?

1151


Is multithreading possible in c?

952


A variable that is defined in a specified portion of a program but can be used throughout the program a) global variable b) local variable c) character d) none

1150