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

What is hashing in c language?

1331


What does stand for?

1093


What are the disadvantages of c language?

1206


What are data structures in c and how to use them?

1183


what is the role you expect in software industry?

2157


Why are some ANSI/ISO Standard library routines showing up as undefined, even though I've got an ANSI compiler?

1139


Explain what is the benefit of using enum to declare a constant?

1099


Write a program to reverse a given number in c?

1051


How can I invoke another program (a standalone executable, or an operating system command) from within a c program?

1224


Why isn't any of this standardized in c? Any real program has to do some of these things.

1228


One of the Institutes contains 5 student groups. Every group contains 4 students. Institute wants to store student group’s details in array. Group should contain group member’s details (name and registration number and age), project name, and mark of the group.

2645


What is double pointer in c?

1047


Write a program on swapping (100, 50)

1137


What is the use of a semicolon (;) at the end of every program statement?

1522


What are the difference between a free-standing and a hosted environment?

1304