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 the program for prime numbers?

Answer Posted / kiran

#include<iostream>
#include<stdio.h>
#include<conio.h>
using namespace std;
int main()
{
int tn=1,c=0,flag=0;;
cin>>tn;
for(int i=3; c!=tn;i++)
{for(int j=2;j<i;j++)
{
if(i%j==0){

flag=0; break;}
else flag=1;
}
if(flag)
{c++;
printf("%d,",i);
}
}
getch();
return 0;
}

Is This Answer Correct ?    4 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is null always equal to 0(zero)?

1033


explain what are actual arguments?

1088


What is the purpose of scanf() and printf() functions?

1243


What does the function toupper() do?

1127


Where is volatile variable stored?

1089


Explain what are binary trees?

1076


What are register variables in c?

1012


What is void c?

1079


What type is sizeof?

1038


What is the use of pointers in C?

1078


the portion of a computer program within which the definition of the variable remains unchanged a) mode b) module c) scope d) none

1055


What is c programming structure?

1194


What are the differences between Structures and Arrays?

1211


what do u mean by Direct access files? then can u explain about Direct Access Files?

2087


Where register variables are stored in c?

966