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

How reliable are floating-point comparisons?

1034


Tell me when is a void pointer used?

1102


What is getche() function?

986


Write a program to swap two numbers without using the third variable?

1016


Why is c called a structured programming language?

1213


write a c program to print the next of a particular no without using the arithmetic operator or looping statements?

3840


What is output redirection?

1165


Can you please explain the difference between syntax vs logical error?

1133


What is the difference between class and object in c?

1088


write a c program to find the largest and 2nd largest numbers from the given n numbers without using arrays

2185


What is the difference between array_name and &array_name?

1239


Explain the difference between strcpy() and memcpy() function?

948


What is a macro, and explain how do you use it?

1015


What are the types of pointers?

1032


What are the 4 data types?

963