Fill in the blanks to complete the following code This code

Fill in the blanks to complete the following code. This code is supposed to add only EVEN values of i. Trace the code. What value for total will displayed after the loop ends?

Solution

Here is the complete program with the filled in blanks. The TOTAL displayed after the loop ends is 14.

#include <stdio.h>
#include <conio.h>
int main()
{
  
   int total= 0;
   int i=9,j;
   while(i>5)
   {
   j=i;
   if((j%2)==0)  
       total=total+j;
  
       i--;
   }
   printf(\"The total is : %d\",total);
}

 Fill in the blanks to complete the following code. This code is supposed to add only EVEN values of i. Trace the code. What value for total will displayed afte

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site