Saturday, 18 November 2017

C++ Program to Implement Euler Theorem


Code:

/* 
 * C++ Program to Implement Euler Theorem
 */
#include  iostream
#include  vector
using namespace std;

vector inverseArray(int n, int m) 
{
    vector modInverse(n + 1, 0);
    modInverse[1] = 1;
    for (int i = 2; i <= n; i++) 
    {
        modInverse[i] = (-(m / i) * modInverse[m % i]) % m + m;
    }
    return modInverse;
}
//Main
int main()
{
    vector::iterator it;
    int a, m;
    cout<<"Enter number to find modular multiplicative inverse: ";
    cin>>a;
    cout<<"Enter Modular Value: ";
    cin>>m;
    cout<
}


Output:

Enter number to find modular multiplicative inverse: 5
Enter Modular Value: 7
3

------------------
(program exited with code: 1)
Press return to continue


More C++ Programs:













100+ Best Home Decoration Ideas For Christmas Day 2019 To Make Home Beautiful

Best gifts for Christmas Day | Greeting cards for Christmas Day | Gift your children a new gift on Christmas day This Christmas d...