View Code of Problem 72

#include <stdio.h>
main()
{
	int i,j,k,h, n;
	float sum = 0, a, b, temp;
	scanf("%d%d", &h, &n);
	sum = h;
	a = h;
	for(i = 1; i <= n; i++)
	{
		sum = sum + a;
		a = a / 2;
	}
	sum = sum - a * 2;
	printf("%.2f %.2f", a, sum);
	printf("\n");
}

Double click to view unformatted code.


Back to problem 72