View Code of Problem 72

#include<iostream>
#include <iomanip>

using namespace std;

int main(){
    double m,len=0,h=0;
    int n;
    cin>>m>>n;
    while(n--){
        len+=h;
        len+=m;
        h=m/2;
        
        m=h;

    }
    cout<<fixed<<setprecision(2)<<h<<" "<<len<<endl;


    return 0;
}

Double click to view unformatted code.


Back to problem 72