SHARE
TWEET

Untitled

a guest Nov 19th, 2019 100 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // razlagane na mnojiteli
  2. #include <iostream>
  3. #include <math.h>
  4.  
  5. using namespace std;
  6.  
  7. int main() {
  8.     int n, p, x;
  9.     unsigned int k = 0;
  10.     cout << "Enter a number: " << endl;
  11.     cin >> n;
  12.  
  13.     cout << "Enter a prime number: " << endl;
  14.     cin >> p;
  15.  
  16.     x = n;
  17.     while (x % p == 0)
  18.     {
  19.         k++;
  20.         x /= p;
  21.     }
  22.     cout << n << " = " << p << "^" << k << " * " << x << endl;
  23.  
  24.     return 0;
  25. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top