View Code of Problem 72

#include<stdio.h>
 main()
{
	int n,i;
	double s=0.0,h,m;
	scanf("%lf %d",&m,&n);
		for(i=1;i<=n;i++)
		{
			h=m;
			m=m/2;
			if(i==1)
				s=h+s;
			else
				s=s+h*2;

				}
		printf("%.2f %.2f\n",m,s);
 }

Double click to view unformatted code.


Back to problem 72