View Code of Problem 72

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

Double click to view unformatted code.


Back to problem 72