rabbinur

prime or not prime

Aug 23rd, 2012
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.31 KB | None | 0 0
  1. #include<iostream.h>
  2. #include<conio.h>
  3. void main()
  4. {
  5. int n, s=0,i;
  6. clrscr();
  7. cout<<"Enter the number"<<endl;
  8. cin>>n;
  9. for(i=2;i<n/2;i++)
  10. {
  11. if(n%i==0)
  12.  s++;
  13. }
  14.      if(s>=1)
  15.      cout<<"The entered number is not prime"<<endl;
  16.      else
  17.      cout<<"The entered number is prime "<<endl;
  18.      getch();
  19. }
Advertisement
Add Comment
Please, Sign In to add comment