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

Please write me a program to print the first 50 prime
numbers (NOT between the range 1 -50)

Answer Posted / sofi

#include <stdio.h>
#include <conio.h>

main()
{
int num,count_prime=1,divisor;
//clrscr();
num =1; //it will exclude all less then 50
while(count_prime!=50)
{
for(divisor=2;divisor<=num;divisor++)
{
if (num % divisor==0)
{ break;
}
}
if(num==divisor)
{
printf("\n%d",num);
count_prime++;
}
num++;
}
getch();
}

Is This Answer Correct ?    10 Yes 21 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What do you mean by keywords in c?

1153


Can you write a programmer for FACTORIAL using recursion?

1044


How do I read the arrow keys? What about function keys?

1088


What does c mean in standard form?

1185


#define f(g,h) g##h main O int i=0 int var=100 ; print f ("%d"f(var,10));} wat would be the output??

1954


Explain void pointer?

1048


Can we initialize extern variable in c?

1138


code for quick sort?

2038


Can the sizeof operator be used to tell the size of an array passed to a function?

1118


When can a far pointer be used?

1028


What is atoi and atof in c?

1088


What is the difference between if else and switchstatement

1936


How to explain the final year project as a fresher please answer with sample project

977


What is void pointers in c?

1008


What does it mean when a pointer is used in an if statement?

1110