diff options
Diffstat (limited to 'ee1301/wk3/lab3/primeFactor.cpp')
-rw-r--r-- | ee1301/wk3/lab3/primeFactor.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/ee1301/wk3/lab3/primeFactor.cpp b/ee1301/wk3/lab3/primeFactor.cpp new file mode 100644 index 0000000..1ec5bcc --- /dev/null +++ b/ee1301/wk3/lab3/primeFactor.cpp @@ -0,0 +1,21 @@ +#include <iostream> +#include <iomanip> +#include <cmath> +using namespace std; +int primefinder (long long n) { + for (long long i=n; i>1; --i) { + + if (n%i==0 && n!=i) { + primefinder(i); + cout << i << "*"; + } + } + return composite; +} +int main () { + long long n; + cout << "Input a positive integer: "; + cin >> n; + primefinder(n); + cout << endl; +} |