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

i want to asked a question about c program the question is:

create a c program that displays all prime numbers less than
500? using looping statement

Answer Posted / vishnu nayak

int main()
{
unsigned int i,k;
unsigned int temp;
int count =0;
printf("enter the number \n");
scanf("%u",&i);
printf("\n");

for(temp =2;temp<i;temp++)
{
count =0;
for(k =2;k<=i;k++)
{
if((temp % k) == 0)
count++;

}
if(count <=1 )
printf("%u \n",temp);

}
getch();
}

Is This Answer Correct ?    1 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is array of structure in c programming?

1240


Differentiate between ordinary variable and pointer in c.

1101


Explain the ternary tree?

968


What is the difference between far and near ?

1156


Can you write the algorithm for Queue?

2029


What is the translation phases used in c language?

1060


Why static is used in c?

1034


What is LINKED LIST? How can you access the last element in a linked list?

1019


What is the difference between the local variable and global variable in c?

927


Can I initialize unions?

987


What does void main () mean?

1179


Write a program with dynamically allocation of variable.

1068


What does the c in ctime mean?

1018


What are the loops in c?

943


Does c have function or method?

943