MCPcopy Create free account
hub / github.com/codemistic/Data-Structures-and-Algorithms / factors

Function factors

CPP/questions/DIFACTRS.cpp:5–17  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3using namespace std;
4
5int factors(int n){
6 int i,count=0;
7 vector<int> v;
8 for(i=1;i<=n;i++){
9 if(n%i==0) {
10 v.push_back(i);
11 count++;
12 }
13 }
14 cout<<count<<"\n";
15 for(int j=0;j<v.size();j++) cout<<v[j]<<" ";
16 cout<<"\n";
17}
18
19int main() {
20 int n;

Callers 1

mainFunction · 0.85

Calls 2

push_backMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected