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

What are the two types of structure?

1040


What is the role of this pointer?

994


How can you call a function, given its name as a string?

1099


What is malloc calloc and realloc in c?

1216


How do you use a 'Local Block'?

1120


How would you use the functions fseek(), freed(), fwrite() and ftell()?

1104


How can I read data from data files with particular formats?

1003


What is time null in c?

1005


What are the types of data types and explain?

1035


Can a function be forced to be inline? Also, give a comparison between inline function and the C macro?

1048


What is the ANSI C Standard?

1212


Why does the call char scanf work?

1154


What is the significance of an algorithm to C programming?

997


When is a void pointer used?

1192


What does volatile do?

937