Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 66f62f9

Browse files
Update get_all_factor.cpp
1 parent 8c9e0ec commit 66f62f9

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

‎best_approach/get_all_factor.cpp‎

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,7 @@
22
/*
33
written by pankaj kumar.
44
*/
5-
#include<algorithm>
6-
#include<string.h>
7-
#include<iostream>
8-
#include<vector>
9-
#include<cmath>
10-
#include<set>
5+
#include <bits/stdc++.h>
116
using namespace std;
127
typedef long long ll ;
138
typedef vector<int> vi;
@@ -37,7 +32,7 @@ int main()
3732
cout<<"List of all factor of "<<a<<"is : ";
3833
for(int i=1;i<=sqrt(a);i++)
3934
{
40-
if(i%a==0)
35+
if(a%i==0)
4136
{
4237
if(a/i==i)
4338
{
@@ -47,10 +42,10 @@ int main()
4742
else
4843
{
4944
count+=2;
50-
cout<<a/i<<" "<<i;
45+
cout<<a/i<<" "<<i<<"";
5146
}
5247
}
5348
}
5449
line;
5550
cout<<"Hence total no of factor of "<<a<<"is "<<count<<endl;
56-
}
51+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /