C++ :
#include <iostream> using namespace std; int main() { double h, s; cin >> h; int n = 1; s = h; while (n < 10) { h/=2; s+=h*2; n=n+1; // cout<<h<<endl; } cout << s <<endl; cout << h/2 <<endl; }
By signing up a 算道OJ universal account, you can submit code and join discussions in all online judging services provided by us.
Using your 算道OJ universal account