some programs!!
This commit is contained in:
1 parent
ed054247d5
commit
71f1022dea
38 files changed
+1037
-281
No files matched your search
@@ -0,0 +1,37 @@
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
using namespace std;
|
||||
|
||||
vector<int> calc_factors( int num) {
|
||||
vector<int> factors;
|
||||
for (const int factor : {3,5,7}) {
|
||||
if (num % factor == 0) {
|
||||
factors.push_back(factor);
|
||||
}
|
||||
}
|
||||
return factors;
|
||||
}
|
||||
|
||||
int num;
|
||||
vector<int> factors;
|
||||
|
||||
int main() {
|
||||
ios::sync_with_stdio(false);
|
||||
cin.tie(nullptr);
|
||||
|
||||
cin >> num;
|
||||
factors = calc_factors(num);
|
||||
if (factors.empty()) {
|
||||
cout << "n" << endl;
|
||||
} else {
|
||||
int temp = factors[factors.size() - 1];
|
||||
factors.pop_back();
|
||||
for (const int factor : factors) {
|
||||
cout << factor << " ";
|
||||
}
|
||||
cout << temp << endl;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in new issue
Block a user