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

Write a program to find whether the given number is prime or
not?

Answer Posted / sudha

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

Is This Answer Correct ?    18 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why is not a pointer null after calling free? How unsafe is it to use (assign, compare) a pointer value after it is been freed?

1121


What is c variable?

1036


Explain what is the purpose of "extern" keyword in a function declaration?

1065


What does *p++ do? What does it point to?

1058


What language is c written?

1041


Give the rules for variable declaration?

1172


What is function definition in c?

1075


Is register a keyword in c?

1034


Explain the difference between ++u and u++?

1129


What is array of pointers to string?

1055


What is the stack in c?

1130


What are reserved words?

1107


When would you use a pointer to a function?

1041


What is a program?

1250


a sequence of bytes with one to one corrspondence to those in the external device a) sequential addressing b) address c) byte code d) none

1265