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

#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
int n,flag=0,ctr;
printf("enter the number to be checked\n");
scanf("%d",&n);
for(ctr=2;ctr<=sqrt(n);ctr++)
{
if(n%ctr==0)
{
flag=1;
break;
}
}
if(flag==0)
printf("the given number is prime\n");
else
printf("the given number is not prime\n");
getch();
}

Is This Answer Correct ?    2 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the various types of control structures in programming?

1104


What is the use of the function in c?

1069


What is hash table in c?

1075


what is different between auto and local static? why should we use local static?

1170


Why is c called c?

1073


Is there any algorithm to search a string in link list in the minimum time?(please do not suggest the usual method of traversing the link list)

2337


What should malloc() do?

1217


What is the sizeof () operator?

1132


What are the benefits of c language?

1228


What are the disadvantages of a shell structure?

1420


What is the difference between scanf and fscanf?

1341


Explain bitwise shift operators?

1314


What are nested functions in c?

1070


How can I read and write comma-delimited text?

1123


Explain what is page thrashing?

1160