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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!