View Code of Problem 72

#include<stdio.h>
#include<stdlib.h>
#include<math.h>
int main(){
	int i,N;
	double M,h,s=0.0;
	scanf("%lf %d",&M,&N);
	for(i=1;i<=N;i++){
		h=pow(0.5,i)*M;
		s=s+4*h;	
	}
		printf("%.2f %.2f",h,s-1000);
}

Double click to view unformatted code.


Back to problem 72