用于模块化幂运算的Python程序
给定三个数字x,y和z,我们的任务是计算(x^y)%z
示例
Input: x = 2, y = 3, p = 3 Output: 2
说明:2^3%3=8%3=2。
算法
Step 1: Input three numbers. Step 2: then we use pow() to calculating power and % for modular. Step 3: display result.
范例程式码
x = int(input("Enter First Value ::>"))
y = int(input("Enter Second Value ::>"))
z= (int)(1e9+7)
# pow function use
d = pow(x, y) % z
print ("Value Is=",d)输出结果
Enter First Value ::> 2 Enter Second Value ::> 3 Value Is= 8
热门推荐
10 初四祝福语简短霸气
11 生活祝福语长辈的话简短
12 接亲祝福语女生文案简短
13 经典新婚祝福语简短英文
14 学生老师离职祝福语简短
15 虎年祝福语 诗句唯美简短
16 虎年幽默搞笑简短祝福语
17 接到英文简短老师祝福语
18 学生励志祝福语大全简短