We are being taught RSA encryption in our school. The teacher told us to write a lame program in C++. It need not be ultra-strong 1024-bit encryption, just to make us familiar.

So, we need thatGCD{ Φ(n), e} = 1

We were suggested to use the Euclidean algorithm by making the ratio of the two nos small and small until it can't be reduced further and at this stage, the least of the two becomes the GCD.

So, anyone has any idea how to convert it into C++ code?