Given three numbers b, e and m. Fill in a function that takes these three positive integer values and outputs b^e mod m.
Input specification:
Input1: poisitive integer, b
Input2: poisitive integer, e
Input3: poisitive integer, m
Output Specification:
Return an integer on calculating b^e mod m.
Example 1:
Input 1: 2
Input 2: 10
Input 3: 1025
Output: 1024
Explanation:
2^10 mod 1025 = 1024
Example 2:
Input 1: 4
Input 2: 10
Input 3: 1025
Output: 1
Explanation:
4^10 mod 1025 = 1
Solution in Python
#https://codewindow.in
#join our telegram channel
b=int(input())
e=int(input())
m=int(input())
print((b**e)%m) #main operation
# Telegram @codewindow
Solution in C :
//https://codewindow.in
//join our telegram channel @codewindow
#include <stdio.h>
#include <math.h>
int main(void) {
int a, b,c;
scanf("%d",&a);
scanf("%d",&b);
scanf("%d",&c);
printf("%d",(int)pow(a,b)%c);
return 0;
}
Solution in C++ :
//https://codewindow.in
//join our telegram channel @codewindow
#include <iostream>
#include <math.h>
using namespace std;
int main(void) {
int a, b,c;
cin >> a;
cin >> b;
cin >> c;
cout << (int)pow(a,b)%c;
return 0;
}

Solution in JAVA
//https://codewindow.in
//join our Telegram Channel
import java.util.*;
import java.lang.*;
import java.io.*;
import java.util.Scanner;
import java.lang.Math;
class Codewindow
{
public static void main (String[] args) throws java.lang.Exception
{
// your code goes here
Scanner in= new Scanner(System.in);
int a,b,c;
a=in.nextInt();
b=in.nextInt();
c=in.nextInt();
System.out.println((int)Math.pow(a,b)%c);
}
}
// Telegram @codewindow
Output:
2
10
1025
1024