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 / antony

#include<stdio.h>


void main()
{
int count=0;
int num=1;
int i;

printf("prime nums \n");
while(count<50)
{
num++;
for (i=2;i<=num-1;i)
{
if(num%i==0)break;
i++;
}
if(i>=num-1)
{
printf("%d ",num);
count++;
}

}
}

Is This Answer Correct ?    93 Yes 47 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do you use a 'Local Block'?

1226


What are the different types of data structures in c?

1215


What is the heap?

1258


Is there a way to have non-constant case labels (i.e. Ranges or arbitrary expressions)?

1127


Explain what is the heap?

1100


Is malloc memset faster than calloc?

1128


what is the basis for selection of arrays or pointers as data structure in a program

4342


If fflush wont work, what can I use to flush input?

1151


What is gets() function?

1188


What is the role of && operator in a program code?

1131


What are the general description for loop statement and available loop types in c?

1166


What is structure data type in c?

1066


Why doesnt that code work?

1272


WHAT IS THE DEFINATION OF IN TECHNOLOGY AND OFF TECHNOLOGY ?

2430


Write programs for String Reversal & Palindrome check

1136