In-Class Practice

Walkthrough


Consider the following problem:

 // Evan Weaver

 int main(void)
 {
         int a;
         double b, c;

         a = 6;
         b = 0.7;
         while (a < 10 && b < 3.0) {
                 if (a < 8) {
                         a = a + 1;
                         b = b * 2;
                         c = a - b;
                 } else {
                         a = a - 2;
                         b = b + 0.8;
                 }
                 c = a - b;
                 printf("%.2lf-%d-%.2lf\n", c, a, b); 
         }
 }

Complete the walkthrough table as follows.  List

  • the name of the program
  • the type of each variable
  • the name of each variable
  • the value of each variable as it changes
  • the output from the program

(    )
   
   

     
     
     
     
     
     

Output:











   Printer Friendly Version of this Page print this page     Top  Go Back to the Top of this Page



  Designed by Chris Szalwinski   Copying From This Site   

Creative Commons License