View Code of Problem 72

#include<stdio.h>
#include<math.h>
#include <string.h>
#define Max 1000
int main ()
{
	float h,a=0,sum=0;
	int i,n;
	scanf("%f %d",&h,&n);
	float temp=h;
	for(i=1;i<n;i++)
	{
		h=h/2;
		a=a+2*h;
	}
	sum=a+temp;
	printf("%.2f %.2f",h/2,sum);
	
	return 0;

}

Double click to view unformatted code.


Back to problem 72