Advertisement
STANAANDREY

bacT15 sIII 1

May 24th, 2021
1,031
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.37 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. void divPrimMax(int n, int &p) {
  5.     int cp = 2;
  6.     bool hasPow;
  7.     while (n > 1) {
  8.         hasPow = false;
  9.         while (n % cp == 0) {
  10.             n /= cp;
  11.             hasPow = true;
  12.         }
  13.         if (hasPow) {
  14.             p = cp;
  15.         }
  16.         cp++;
  17.     }
  18. }
  19.  
  20. int main() {
  21.     //call here
  22.     return 0;
  23. }
  24.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement