[sourcecode language="cpp"]
#include <iostream>
using namespace std;
int main()
{
int num=0;
int count=0;
int prime=1;
char ans=' ';
do
{
cout <<"Enter a number: ";
cin >> num;
for (int i=(num)/2; i>1; i--)
{
if (num%i==0)
{
count=count+1;
if (count==1)
cout <<"Internal Factor(s): ";
prime=0;
cout <<i<<" ";
}
}
if (prime==0)
{
cout<<"\nNumber is not prime."<<endl;
}
if (prime==1)
{
cout <<"Number is prime."<<endl;
}
cout<<"Do you wish to find another prime: ";
cin>>ans;
cin.ignore(200,'\n');
count=0;
prime=1;
system("cls");
}while(ans =='y' || ans=='Y');
system("pause");
return 0;
}
[/sourcecode]
Subscribe to:
Post Comments (Atom)
How to enable CORS in Laravel 5
https://www.youtube.com/watch?v=PozYTvmgcVE 1. Add middleware php artisan make:middleware Cors return $next($request) ->header('Acces...
-
< Requirements Java Development Kit (JDK) NetBeans IDE Apache Axis 2 Apache Tomcat Server Main Topics Setup Development Environ...
-
Download Sourcecode [sourcecode language="csharp"] using System; using System.Collections.Generic; using System.Linq; using System...
No comments:
Post a Comment