View Code of Problem 72

#include<stdio.h>
#include<string.h>
#include<math.h>
int main()
{
	double sum=0,s;
	double m;
	int n;
	scanf("%lf %d",&m,&n);
	sum+=m;
	m=m/2;
	for(int i=0;i<n-1;i++)
	{
		sum=sum+m*2;
		m=m/2;
	}
	printf("%.2lf %.2lf\n",m,sum);
}

Double click to view unformatted code.


Back to problem 72