View Code of Problem 3692

#include<iostream>
using namespace std;
int main() {
	int t;
	while (cin >> t) {
		int sum = 3;
		if (t % 2 == 0)sum = pow(2, t) + 2;
		else if(t>1)sum = pow(2, t) - 2;
		cout << sum << endl;
	}
}
/*
Main.cc: In function 'int main()':
Main.cc:7:24: error: 'pow' was not declared in this scope
   if (t % 2 == 0)sum = pow(2, t) + 2;
                        ^~~
Main.cc:7:24: note: suggested alternative: 'putw'
   if (t % 2 == 0)sum = pow(2, t) + 2;
                        ^~~
                        putw
Main.cc:8:21: error: 'pow' was not declared in this scope
   else if(t>1)sum = pow(2, t) - 2;
                     ^~~
Main.cc:8:21: note: suggested alternative: 'putw'
   else if(t>1)sum = pow(2, t) - 2;
                     ^~~
                     putw
*/

Double click to view unformatted code.


Back to problem 3692