View Code of Problem 72

#include<stdio.h>
int main(){
	int i,k;
	double h,s=0,h1;
	scanf("%lf %d",&h,&k);
	h1=h;
	for(i=0;i<k;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