View Code of Problem 72

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

Double click to view unformatted code.


Back to problem 72