Lets learn C++

Sunday, 17 November 2013

C++ Program To Find Prime Numbers



#include<iostream.h>
#include<conio.h>

void main()

{

clrscr();

int number,count=0;

cout<<"ENTER NUMBER TO CHECK IT IS PRIME OR NOT ";

cin>>number;

for(int a=1;a<=number;a++)

{

if(number%a==0)

{
count++;
}

if(count==2)
{
cout<<" PRIME NUMBER \n";

}

else

{

cout<<" NOT A PRIME NUMBER \n";

}
getch();
}
Posted by Unknown at 10:07
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest

No comments:

Post a Comment

Newer Post Older Post Home
Subscribe to: Post Comments (Atom)

About Me

Unknown
View my complete profile

Pages

  • Home

Blogger news

Blogroll

About

Archives

  • ▼  2013 (15)
    • ▼  November (15)
      • C++ program to find last prime number that occurs ...
      • C++ code to swap two variables without using third...
      • C++ program code to swap the values of two integer:
      • C++ program to find the Area and Perimeter of a Re...
      • C++ Program to find the area of any triangle using...
      • C++ Program to Find the Binary Value of Decimal Nu...
      • Program to find factorial of Number in C++
      • TO FIND THE PERFECT NUMBER IN C++
      • C++ Program To Find Prime Numbers
      • 6. Write a C++ program to create a class called ST...
      • 5. Write a C++ program to create a class called DA...
      • 4. Write a C++ program to create a class called ST...
      • C++ program to create a class called COMPLEX and i...
      • 2. Define a STUDENT class with USN, Name, and Mark...
      • 1. Given that an EMPLOYEE class contains the follo...
Picture Window theme. Powered by Blogger.