View Code of Problem 72

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

Double click to view unformatted code.


Back to problem 72