[Solved] Computing a formula using do/while statements [closed]


Your formula can be translated like this:

double i = 1;
double sum = 0;

do{
    sum += (1/i + 18*i);
    i--;
} while (i < 16);

I’m not really sure that using a do while is the best option, it would probably be better with a for loop like so:

double sum = 0;
for (double i = 1; i < 16; ++i){
    sum += (1/i + 18*i);
}

1

solved Computing a formula using do/while statements [closed]