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 / arunkumar mt

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

Is This Answer Correct ?    2 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is difference between && and & in c?

1045


Explain how can I prevent another program from modifying part of a file that I am modifying?

1037


What does c mean in basketball?

944


What is the use of define in c?

1001


Can you add pointers together? Why would you?

1072


Can a pointer be volatile in c?

931


what is the difference between 123 and 0123 in c?

1157


Who developed c language?

1039


explain what is a newline escape sequence?

1040


What is the auto keyword good for?

1065


What is typedef struct in c?

1000


Explain what is the difference between functions getch() and getche()?

990


Difference between exit() and _exit() function?

1077


A variable that is defined in a specified portion of a program but can be used throughout the program a) global variable b) local variable c) character d) none

1147


Explain how do you sort filenames in a directory?

983