hopingsteam

Untitled

Apr 25th, 2020
358
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. int putere(unsigned int n, unsigned int p)
  2. {
  3.     int div = 2, exp = 0;
  4.     while(n > 1)
  5.     {
  6.         while(n % div == 0)
  7.         {
  8.             exp = exp + 1;
  9.             n = n / div;
  10.         }
  11.         if(exp != 0)
  12.         {
  13.             if(div == p)
  14.                 return exp;
  15.         }
  16.         exp = 0;
  17.         div = div + 1;
  18.     }
  19.     return -1;
  20. }
RAW Paste Data