Notes

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

  • Accountancy (1)
  • Business Studies (3)
  • C (1)
  • C++ (6)
  • Class - XII (8)
  • Eclipse (2)
  • Economics (3)
  • English (1)
  • JAVA (2)

About Me

Unknown
View my complete profile

Top 5 Posts of the Week

Popular Posts(All Time)

  • POSTER
  • Essential Features or Characteristics Of Partnership
  • Define Management.
  • What is Economy?
  • Scarcity
  • Relation between Efficiency and Effectiveness
  • Write a program to find the reverse of an inputted number.
  • What is economics all about?
  • Write a program for matrix addition, subtraction and multiplication.
  • Efficiency vs Effectiveness

Blog Archive

  • ►  2013 (13)
    • ►  March (8)
    • ►  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...
Ethereal theme. Powered by Blogger.