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

how to find the given number is prime or not?

Answer Posted / rahul tiwari

main()
{
int n,ctr=2,flag=0;
printf("enter the number to be checked\n");
scanf("%d",&n);
for(ctr=2;ctr<=n/2;ctr++)
{
if(n%ctr==0)
{
flag=1;
break;
}
}
if(flag==1)
printf("the given number is prime\n");
else
printf("the given number is not prime\n");
flag=9
getch();
}

Is This Answer Correct ?    8 Yes 7 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Are enumerations really portable?

975


What does double pointer mean in c?

1070


How to draw the flowchart for structure programs?

9245


Should I learn data structures in c or python?

972


Where define directive used?

1031


PLS U SENS ME INTERVIEW O. MY EMAIL ADD, SOFIYA.SINGH@GMAIL.COM

2144


Which function in C can be used to append a string to another string?

1172


Should I learn c before c++?

1173


Write a program to check prime number in c programming?

1026


What is the equivalent code of the following statement in WHILE LOOP format?

1244


What are the scope of static variables?

1112


How do you declare a variable that will hold string values?

1103


Give the rules for variable declaration?

1109


Tell me is null always defined as 0(zero)?

1031


What is the difference between c &c++?

1078