View Code of Problem 72

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

Double click to view unformatted code.


Back to problem 72