#include<bits/stdc++.h>
using namespace std;
int power(int n, int p)
{
int x = 0;
while(n > 0)
{
n = n/p;
x = x + n;
}
return x;
}
int main()
{
int n, p;
cout << "Enter Number & Divided Number :: ";
cin >> n >> p;
int r = power(n, p);
cout << endl << "Largest Power Of P :: ";
cout << r << endl;
return 0;
}
using namespace std;
int power(int n, int p)
{
int x = 0;
while(n > 0)
{
n = n/p;
x = x + n;
}
return x;
}
int main()
{
int n, p;
cout << "Enter Number & Divided Number :: ";
cin >> n >> p;
int r = power(n, p);
cout << endl << "Largest Power Of P :: ";
cout << r << endl;
return 0;
}
Comments
Post a Comment