Skip to content

Commit

Permalink
Merge pull request #3 from Sahilkalamkar/master
Browse files Browse the repository at this point in the history
Added comments to modularExponentiation.cpp
  • Loading branch information
yashasvi-goel authored Oct 13, 2019
2 parents 39272b0 + 9a19c7f commit da43c0b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions modularExponentiation.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
/*Author: Sahil Kalamkar
*Date: 13/10/2019
*/
#include<bits/stdc++.h>

using namespace std;
typedef long long ll;
const int mod = 1e9+7;

//Function to calculate a raised to the power of b modulo m for large values.
ll modularExponentiation(ll base,ll exponent,ll modulo)
{
if(exponent==0)
Expand All @@ -20,10 +24,10 @@ ll modularExponentiation(ll base,ll exponent,ll modulo)
}

int main()
{
{
//Input Format: 3 integers denoting the base,the power and the integer with which you want the remainder.
int base,power,m;
cin>>base>>power>>m;

cout<<modularExponentiation(base,power,m)<<'\n';
return 0;
}

0 comments on commit da43c0b

Please sign in to comment.