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 are logical errors and how does it differ from syntax errors?

1309


Why void is used in c?

1023


What is static memory allocation?

1187


Where define directive used?

1101


How can you read a directory in a C program?

1149


Are pointers integers in c?

1083


What is chain pointer in c?

1068


What does c mean?

1059


What do you mean by Recursion Function?

1131


What are local static variables?

1160


Explain how can a program be made to print the name of a source file where an error occurs?

1200


When can you use a pointer with a function?

1081


a function gets called when the function name is followed by a a) semicolon (;) b) period(.) c) ! d) none of the above

1397


Is int a keyword in c?

985


What is the purpose of realloc()?

1149