mirror of
https://github.com/TheAlgorithms/C-Plus-Plus.git
synced 2026-02-11 14:36:25 +08:00
Resolve typo errors
This commit is contained in:
@@ -31,7 +31,7 @@ int binExpo(int a, int b) {
|
||||
/// Iterative function to calculate exponent in O(log(n)) using binary exponent.
|
||||
int binExpo_alt(int a, int b) {
|
||||
int res = 1;
|
||||
while (b>0) {
|
||||
while (b > 0) {
|
||||
if (b%2) {
|
||||
res = res*a;
|
||||
}
|
||||
@@ -45,9 +45,9 @@ int main() {
|
||||
int a, b;
|
||||
/// Give two numbers a, b
|
||||
std::cin >> a >> b;
|
||||
if (a==0 && b==0) {
|
||||
if (a == 0 && b == 0) {
|
||||
std::cout << "Math error" << std::endl;
|
||||
} else if (b<0) {
|
||||
} else if (b < 0) {
|
||||
std::cout << "Exponent must be positive !!" << std::endl;
|
||||
} else {
|
||||
int resRecurse = binExpo(a, b);
|
||||
|
||||
Reference in New Issue
Block a user