View Code of Problem 72

#include<stdio.h>
#include<math.h>
void main(){
	int m,n,i;
	double s,h,t;
	scanf("%d%d",&m,&n);
	if(n==1)
		s=m;
	else{
		s=m;
		h=m;
		for(i=1;i<n;i++){
			h=h*0.5;
			s=s+2*h;
		}
	}
	h=m;
	for(i=0;i<n;i++)
		h=h*0.5;
	printf("%.2f %.2f",h,s);
			
}

Double click to view unformatted code.


Back to problem 72