M
M
Mikhail Evstigneev2018-09-06 22:42:31
C++ / C#
Mikhail Evstigneev, 2018-09-06 22:42:31

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

1 answer(s)
R
Roman, 2018-09-06
@NariusMag

www.e-maxx-ru.1gb.ru/algo/discrete_root

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question