MAD Programmer

Sunday, December 23, 2012

Write a program to check whether the number is prime number or not.

Screenshots:-



To Download the files


---------Click Here---------








____________________________________________________________
#include<iostream.h>
#include<conio.h>
 void prime(int &x);
 void main()
  { int n;
    clrscr();
    cout<<"\nEnter A Number: ";
    cin>>n;
    prime(n);
    getch();
  }
 void prime(int &x)
  { int i,c=0;
    for(i=1;i<=x;i++)
      {
       if(x%i==0)
    {c++;}
      }
     if(c==2)
       cout<<"\n\tPrime no.: "<<x;
     else
       cout<<"\n\tNot a Prime no.: "<<x;
  } 

____________________________________________________________

Posted by Unknown at 8:13 AM
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest
Labels: C++

No comments:

Post a Comment

Newer Post Home
Subscribe to: Post Comments (Atom)

Categories

  • C (1)
  • C++ (6)
  • Eclipse (2)
  • JAVA (2)

Search The Site

Popular Programs

  • Write a program for matrix addition, subtraction and multiplication.
  • Write a program to find the reverse of an inputted number.
  • Write a program to check whether the number is prime number or not.
  • What is Eclipse?
  • How to use the Eclipse IDE for the first time.
  • What is datatypes in C.(Brief)
  • Running a Java Program from Command Prompt
  • Write a program to find the factorial of a number.
  • Write a program to print the Fibonacci series.
  • What is Java technology and why do I need it?

About Me

Unknown
View my complete profile

List Of All Programs

  • ►  2013 (5)
    • ►  January (5)
  • ▼  2012 (6)
    • ▼  December (6)
      • Write a program for matrix addition, subtraction a...
      • Write a program to print the Fibonacci series.
      • Write a program to find the factorial of a number.
      • Write a program to find the sum of the digits of a...
      • Write a program to find the reverse of an inputted...
      • Write a program to check whether the number is pri...
Picture Window theme. Powered by Blogger.