C++ Program for Prime Number
Master C++ with Real-time Projects and Kickstart Your Career Start Now!!
Program 1
//Program for prime number
#include<iostream>
using namespace std;
int main()
{
int n,i=2,f=0;
system("cls");
cout<<"Enter a number";
cin>>n;
while(i<n)
{
if(n%i==0)
{
f=1;
break;
}
i++;
}
if(f==0)
cout<<"\n No is prime";
else
cout<<"\n No is not prime";
}
You give me 15 seconds I promise you best tutorials
Please share your happy experience on Google

