fork download
  1. #include <iostream>
  2. #include <vector>
  3. #include <set>
  4. #include <ctime>
  5. #include <string.h>
  6. using namespace std;
  7.  
  8. int main() {
  9. int N;
  10. cin >> N;
  11. //a)
  12. for(int i=1; i<=N; i++){
  13. if(N%i ==0){
  14. int b = N/i;
  15. cout << i << "*"<< b << endl;
  16. }
  17. }
  18. cout << "--" << endl;
  19. //b)
  20. for(int i=1; i*i<=N; i++){
  21. if(N%i ==0){
  22. int b = N/i;
  23. cout << i << "*" << b << endl;
  24. }
  25. }
  26. return 0;
  27. }
  28.  
Success #stdin #stdout 0s 5312KB
stdin
12
stdout
1*12
2*6
3*4
4*3
6*2
12*1
--
1*12
2*6
3*4