C++ Program – Sum of Prime nos

by Nideesh C on May 2, 2011 · 0 comments

in C++




//Downloaded From theonlinetutorials.com
//(C)1999.All rights reserved.
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int p=0,i,n;
cout<<"Enter the no :"<<endl;
cin>>n;
for(i=2;i<=(n/2);i++)
{
if(n%i==0)
p=1;
}
if(p==0)
cout<<"Prime";
else if (p==1)
cout<<"Not Prime";
getch();
}



Not Satisfied ? Just search & get the result

Related Posts Plugin for WordPress, Blogger...
Be Sociable, Share!

Related posts:

  1. C++ Program – Sum of Odd Even nos
  2. C Program for prime numbers
  3. C Program to find the prime numbers below a given number.
  4. C Program to find the prime numbers between a given range
  5. C++ program – Sum of n even Nos

Leave a Comment

Previous post:

Next post: