Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion 18-Programming-4kids/04_homework_08_answer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,17 @@ int main() {
// Either 1*something + 0*something for b = 1
// Or 0*something + 1*something for b = -1
cout<<is_1 * equ_is_1 + is_neg_1 * equ_is_neg_1;

/*
we can try the following syntax with this equation in mind
A**(B+1) + ((1-B) * A)
*/
#include <math.h>
using namespace std;


int num1, num2;
cin >> num1 >> num2;
cout << pow(num1, (num2 + 1)) + ((1-num2)* num1) << endl;
return 0;
}