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 / ashwin kumar

its just to find weather given number is prime or not


#include<stdio.h>
#include<conio.h>
int main()
{
int value,i,flag=0;
clrscr();
printf("enter value to check for prime number : ");
scanf("%d",&value);
for(i=2;i<value;i++)
{
if(value%i==0)
{

flag=flag+1;
break;

}


}
if(flag==1||value==2)
printf(" %d is not a prime number",value);
else
printf(" %d is a prime number",value);

getch();
return 0;

}

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is #line?

1112


Which programming language is best for getting job 2020?

1102


Is anything faster than c?

1064


Should I use symbolic names like true and false for boolean constants, or plain 1 and 0?

1130


How can I get the current date or time of day in a c program?

1270


Write a program to check armstrong number in c?

1186


What does int main () mean?

1078


What does the error 'Null Pointer Assignment' mean and what causes this error?

1260


What are the primitive data types in c?

1134


application attempts to perform an operation?

2036


what are the facialities provided by you after the selection of the student.

2335


What is the size of array float a(10)?

1193


What is a static variable in c?

1170


What is the use of gets and puts?

1093


Can you add pointers together? Why would you?

1183