View Code of Problem 72

#include <stdio.h>
void main(){
	int i=1,n;
	double h,s;
	scanf("%lf%d",&h,&n);
	s=h;
	while(i<n){
		h/=2;
		s+=(2*h);
		i++;
	}
	printf("%.2f %.2f",h/2,s);
}

Double click to view unformatted code.


Back to problem 72