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 the program for prime numbers?

Answer Posted / pran pratim

#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int num,i,count=0;
cout<<"Enter the number::";
cin>>num;
for(i=2;i<=num/2;i++)
{
if(num%i==0)
{
count++;
break;
}
}
if(count==0)
{
cout<<"The number is Prime";
}
else
cout<<"The number is Composite";
getch();
}

Is This Answer Correct ?    2 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

if p is a string contained in a string?

1795


What is dynamic memory allocation?

1283


What is a rvalue?

1140


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

16590


Do you know what are the properties of union in c?

999


What is bash c?

959


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

1247


the maximum length of a character constant can be a) 1 character b) 8 characters c) 256 chaacters d) 125 characters

2234


What is the scope of an external variable in c?

982


What are reserved words?

1046


How do I get a null pointer in my programs?

1060


What are type modifiers in c?

1000


int far *near * p; means

3505


i have a written test for microland please give me test pattern

2666


Why do we need a structure?

979