View Code of Problem 72

#include<iostream>
#include<cstdio>

using namespace std;

int main()
{
  int n;double m;
  cin>>m>>n;
  double temp=m,sum=0;
  while(n--)
  {
    sum+=temp;
    m/=2.0;
    if(n!=0) sum+=m;
    temp=m;
  }
  printf("%.2f %.2f",temp,sum);
}

Double click to view unformatted code.


Back to problem 72