Question: int main( void ) { double x = 0.0, num = 3.0, denom = 1.0; int loop, ac; ac = 4; for ( loop =
int main( void )
{
double x = 0.0, num = 3.0, denom = 1.0;
int loop, ac;
ac = 4;
for ( loop = 1; loop <= ac; loop++ ) {
if ( loop % 2 != 0 )
x += num / denom;
else
x -= num / denom;
denom += 2.0;
}
printf( %.2f ", x );
return 0;
}
please explain the code
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
