We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents c5bbbc8 + 246fd18 commit 52a3977Copy full SHA for 52a3977
prime_factor.cpp
@@ -0,0 +1,33 @@
1
+#include <iostream>
2
+#include <limits.h>
3
+using namespace std;
4
+
5
+ void printPrimeFactors(int n)
6
+{
7
+ if(n <= 1)
8
+ return;
9
10
+ for(int i=2; i*i<=n; i++)
11
+ {
12
+ while(n % i == 0)
13
14
+ cout<<i<<" ";
15
16
+ n = n / i;
17
+ }
18
19
20
+ if(n > 1)
21
+ cout<<n<<" ";
22
23
+ cout<<endl;
24
+}
25
26
+int main() {
27
28
+ int n = 450;
29
30
+ printPrimeFactors(n);
31
32
+ return 0;
33
0 commit comments