View Code of Problem 72

#include<bits/stdc++.h>
using namespace std;
int main() {
	int M,N;
	double sum=0;
	cin>>M>>N;
	for(int i=1; i<=N; i++) sum+=M/pow(2,i-1)+M/pow(2,i);
	printf("%.2f %.2f", M/pow(2,N), sum-M/pow(2,N));
}

Double click to view unformatted code.


Back to problem 72