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 / shrikanth s.hallikhed

#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==1)
printf("the given number is prime\n");
else
printf("the given number is not prime\n");
getch();
}

Is This Answer Correct ?    3 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is void c?

1079


Is c a great language, or what?

1112


Write a program to swap two numbers without using third variable in c?

1130


c language interview questions & answer

1958


is it possible to create your own header files?

1105


What is #ifdef ? What is its application?

1108


hi... can anyone help me to make a two-dimensinal arrays in finding the sum of two elements plzzz. thnx a lot...

1915


How to check whether string is a palindrome, WITHOUT USING STRING FUNCTIONS?

16775


What does it mean when the linker says that _end is undefined?

1097


What does. int *x[](); means ?

1067


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

1197


Can you subtract pointers from each other? Why would you?

961


Why is c called a structured programming language?

1274


Explain what is wrong with this program statement? Void = 10;

1261


What is the purpose of type declarations?

1114