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

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

1133


How to delete a node from linked list w/o using collectons?

2824


What is use of integral promotions in c?

1207


How can a process change an environment variable in its caller?

1235


What do you mean by command line argument?

1227


What is a dynamic array in c?

1219


What do you mean by keywords in c?

1198


When should a type cast be used?

1065


What is ## preprocessor operator in c?

1133


How do you determine the length of a string value that was stored in a variable?

1170


What are the types of i/o functions?

1420


Why we use void main in c?

1229


How is a structure member accessed?

1186


‘SAVEPOINT’ and ‘ROLLBACK’ is used in oracle database to secure the data comment. Give suitable examples of each with sql command.

2388


Tell us something about keyword 'auto'.

1109