View Code of Problem 72

#include <stdio.h>
using namespace std;
int main(){
	
	double m;
	int n;
	scanf("%lf%d", &m, &n );
	double k =0;
	double sum = m;
	while( n-- ){
		k = m/2;
		sum += 2*k;
		m = m/2;	
	}
	printf("%.2lf %.2lf\n", k ,sum-2*k);
	return 0;
	
}

Double click to view unformatted code.


Back to problem 72