Advertisement
ramomjcs

Lista Monitoria

Feb 22nd, 2019
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main(){
  6.  
  7. int array[INT8_MAX];
  8.  
  9. int x;
  10. cin >> x;
  11.  
  12. int i = 1;
  13. int j = 0;
  14.  
  15.  
  16. while(i <= x){
  17. array[j] = i;
  18. i++;
  19. j++;
  20. }
  21.  
  22. int y = 0;
  23.  
  24. while(y < x){
  25. for(int j = 0 ; j < x ; j++){
  26. if( (array[y] % array[j] == 0) && (array[y] % array[j] < x) && (array[y] * array[j] > x) ){
  27. cout << array[y];
  28. cout << " ";
  29. cout << array[j] << endl;
  30. return 0;
  31. }
  32. }
  33. y++;
  34. }
  35.  
  36. cout << "-1";
  37. cout << endl;
  38.  
  39. return 0;
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement