View Code of Problem 72

#include<stdio.h>
int main()
{
	int n,i;
	float m,sum,h;
	scanf("%f %d",&m,&n);
	sum=m;
	h=m;
	for(i=2;i<=n;i++)
	{
		h=h/2.0;
		sum+=2*h;
	}
	printf("%.2f %.2f",h/2,sum);
	return 0;
}

Double click to view unformatted code.


Back to problem 72