8000
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.
1 parent 8c9e0ec commit 66f62f9Copy full SHA for 66f62f9
best_approach/get_all_factor.cpp
@@ -2,12 +2,7 @@
2
/*
3
written by pankaj kumar.
4
*/
5
-#include<algorithm>
6
-#include<string.h>
7
-#include<iostream>
8
-#include<vector>
9
-#include<cmath>
10
-#include<set>
+#include <bits/stdc++.h>
11
using namespace std;
12
typedef long long ll ;
13
typedef vector<int> vi;
@@ -37,7 +32,7 @@ int main()
37
32
cout<<"List of all factor of "<<a<<"is : ";
38
33
for(int i=1;i<=sqrt(a);i++)
39
34
{
40
- if(i%a==0)
35
+ if(a%i==0)
41
36
42
if(a/i==i)
43
@@ -47,10 +42,10 @@ int main()
47
else
48
49
44
count+=2;
50
- cout<<a/i<<" "<<i;
45
+ cout<<a/i<<" "<<i<<" ";
51
46
}
52
53
54
line;
55
cout<<"Hence total no of factor of "<<a<<"is "<<count<<endl;
56
-}
+}
0 commit comments