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

Stimulate calculator using Switch-case-default statement for two numbers

2998


Explain pointer. What are function pointers in C?

1081


Explain #pragma statements.

1052


Write a c program to demonstrate character and string constants?

2192


Why c is faster than c++?

1044


What is linear search?

1138


Can you apply link and association interchangeably?

1125


Explain the difference between malloc() and calloc() function?

1057


Why is main function so important?

1107


What is header file definition?

1087


What is the stack in c?

1156


What is a c token and types of c tokens?

1069


What's the right way to use errno?

1149


What are the general description for loop statement and available loop types in c?

1129


Is Exception handling possible in c language?

2048