From 331fce2203a1074ed39375f4c31eb3cb7211cf3b Mon Sep 17 00:00:00 2001 From: Mann Mehta <44433995+mann2108@users.noreply.github.com> Date: Thu, 2 Apr 2020 04:34:47 +0530 Subject: [PATCH] resolve else clause formatting error --- math/binary_exponent.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/math/binary_exponent.cpp b/math/binary_exponent.cpp index 7ca388451..8f7a90ca8 100644 --- a/math/binary_exponent.cpp +++ b/math/binary_exponent.cpp @@ -10,10 +10,16 @@ /// Function to calculate exponent in O(log(n)) using binary exponent. int binExpo(int a, int b) { - if (b == 0) return 1; + if (b == 0) { + return 1; + } int res = binExpo(a, b/2); - if (b%2) return res*res*a; - else return res*res; + if (b%2) { + return res*res*a; + } + else { + return res*res; + } } int main() { @@ -23,4 +29,3 @@ int main() { /// Result of a^b std::cout << binExpo(a, b) << std::endl; } -