View Code of Problem 72

#include<stdio.h>
int main()
{
	int N,i;
	double h,sum,temp;
	scanf("%lf %d",&h,&N);
	temp=h;
	for(i=1;i<N;i++)
	{
		h=h/2;
		sum+=2*h;
	}
	sum=sum+temp;
	
	printf("%.2f %.2f",h/2,sum);
    return 0;
}

Double click to view unformatted code.


Back to problem 72