View Code of Problem 72

#include<stdio.h>
#include<string.h>
#include<math.h>
int main()
{
	int m,n,i;
	float s=0,h;
	scanf("%d %d",&m,&n);
	s=h=m;
	h=h/2;
	for(i=2;i<=n;i++)
	{
		s=s+h*2;
		h=h/2;
	}
	printf("%.2f %.2f",h,s);
	return 0;
}

Double click to view unformatted code.


Back to problem 72