hopingsteam

Untitled

Apr 22nd, 2020
367
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. void prodprim(unsigned int n, unsigned int &p)
  2. {
  3.     p = 1;
  4.     int div = 2, exp = 0;
  5.     while(n > 1)
  6.     {
  7.         while(n % div == 0)
  8.         {
  9.             n = n / div;
  10.             exp++;
  11.         }
  12.         if(exp > 0)
  13.         {
  14.             p = p * div;
  15.             cout << div << " ^ " << exp << "\n";
  16.         }
  17.         div = div + 1;
  18.         exp = 0;
  19.     }
  20. }
RAW Paste Data