View Code of Problem 72

#include<iostream>

using namespace std;

int main(){
	int m;
	int n;
	cin>>m>>n;
	double sum=0;
	double height=m;
	for(int i=0;i<n;++i){
		sum+=height;
		height/=2;
		if(i!=n-1){
			sum+=height;
		}
	}
	printf("%.2lf %.2lf",height,sum);
	return 0;
}

Double click to view unformatted code.


Back to problem 72