View Code of Problem 72

#include <stdio.h>
int main(){
  int n,i;
  float height;
  float m;
  float sum;
  float temp;
  scanf("%f",&m);
  scanf("%d",&n);
  sum=m;
  temp=m;
  for(i=0;i<n;i++){
    height = temp/2;
    temp=height;
    sum+=height;
  
  }
  if(n>1){
	  sum=2*sum-m-height;
  }
  printf("%.2f %.2f",height,sum);



return 0;
}

Double click to view unformatted code.


Back to problem 72