fork download
  1. #include <iostream> // PRIME_mult.cpp DANILIN
  2. #include <cmath> // rextester.com/YDXE69472
  3. using namespace std; int main()
  4. { setlocale (LC_ALL, "RUS"); srand(time(NULL));
  5. int i; int f=0,j=2,q=0; double p,s; p=0; // long p = 2147483648-1;
  6. for (i=0;i<9;i++) p=p+pow(10., i)*(rand()%10);
  7. s = int (pow(p, 0.5));
  8. cout << int(p) <<" "<< s << endl;
  9. while (f < 1)
  10. { if (j >= s) { f=2; }
  11. if (int (p) % int (j) == 0)
  12. { q=1; cout << int(p) <<" "<<j<<" "<< int(p/j) <<endl;}
  13. j++;
  14. }
  15. if (q != 1) { cout <<"Prime "<< p << endl; }
  16. system("pause");
  17. }
  18.  
Success #stdin #stdout #stderr 0.01s 5276KB
stdin
Standard input is empty
stdout
459568405 21437
459568405 5 91913681
459568405 23 19981235
459568405 59 7789295
459568405 115 3996247
459568405 295 1557859
459568405 1357 338665
459568405 6785 67733
stderr
sh: 1: pause: not found