Answer the question
In order to leave comments, you need to log in
How to implement discrete root extraction in C++?
Good afternoon. My program must take the discrete root modulo a number, provided that ( k^2 - n ) is divisible by m without remainder. ( k^2 = n(mod m) ). I have not studied C++ before, but in general the topic is not close to me. I would be grateful if you point me in the right direction.
PS My under-code is below...
#include
#include
#include
using namespace std;
int main() {
int k, l;
int n, m, h;
cout << "Input a positive integer>"; cin >> n;
cout << "Input a modulo>"; cin >> m;
k = sqrt(n%m);
l = k*k;
h = (ln);
if(((h%m)==0)&&(k>0)) {
cout << int(k);
cout << "Not found";
}
return 0;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question