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

Explain what are the different file extensions involved when programming in c?

1073


Explain the meaning of keyword 'extern' in a function declaration.

1133


Why we use void main in c?

1124


What is difference between structure and union with example?

1015


Write a c program to demonstrate character and string constants?

2138


What is the purpose of ftell?

1053


What is double pointer in c?

1007


What is dynamic dispatch in c++?

1023


What is getch c?

1262


Write a program to compute the similarity between two strings - The program should get the two strings as input - Then it will output one single number which is the percentage of similarity between the two strings

2719


What does dm mean sexually?

1272


What is a macro?

1064


What is n in c?

985


Is it possible to initialize a variable at the time it was declared?

1196


What is meant by gets in c?

1120