mirror of
https://github.com/TheAlgorithms/C-Plus-Plus.git
synced 2026-02-03 18:46:50 +08:00
resolve format error
This commit is contained in:
@@ -9,18 +9,18 @@
|
||||
*/
|
||||
|
||||
/// Function to calculate exponent in O(log(n)) using binary exponent.
|
||||
int binExpo(int a,int b) {
|
||||
int binExpo(int a, int b) {
|
||||
if (b == 0) return 1;
|
||||
int res = binExpo(a,b/2);
|
||||
int res = binExpo(a, b/2);
|
||||
if (b%2) return res*res*a;
|
||||
else return res*res;
|
||||
}
|
||||
|
||||
int main() {
|
||||
int a,b;
|
||||
int a, b;
|
||||
/// Give two nos as a^b (where '^' denotes power exponent operation)
|
||||
std::cin >> a >> b;
|
||||
/// Result of a^b
|
||||
std::cout << binExpo(a,b) << std::endl;
|
||||
std::cout << binExpo(a, b) << std::endl;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user