Consider in a program segment that x 4 8 and y 172 150 i

Consider in a program segment that x = 4, 8 and y = 17.2 = 15.0 i = 2 j = 7 k = 9 Trace all variables (Memory snapshots) along the showing any output at the appropriate points in the exact TABLE! Is a must here). While (i>0){if(x>y) if(y

Solution

#include <iostream>
using namespace std;
#include <iomanip>

int main() {
   float x,y,z,i,j,k;
   x=4.8;
   y=17.2;
   z=15.0;
   i=2;
   j=7;
   k=9;
  
   while(i>0)
   {
       if(x>y)
       if(y<z)
       {
           k=k+1;
           cout<<\"x=\"<<x<<setw(3)<<\"y=\"<<y<<setw(3)<<\"z=\"<<z<<setw(3)<<\"i=\"<<i<<setw(3)<<\"j=\"<<j<<setw(3)<<\"k=\"<<k<<endl;
       }
       else
       j=j+3;
       else
       y=y-10;
       x=x+10;
       cout<<\"x=\"<<x<<setw(3)<<\"y=\"<<y<<setw(3)<<\"z=\"<<z<<setw(3)<<\"i=\"<<i<<setw(3)<<\"j=\"<<j<<setw(3)<<\"k=\"<<k<<endl;
      
       i=i-1;
       cout<<\"x=\"<<x<<setw(3)<<\"y=\"<<y<<setw(3)<<\"z=\"<<z<<setw(3)<<\"i=\"<<i<<setw(3)<<\"j=\"<<j<<setw(3)<<\"k=\"<<k<<endl;
       }
  
   return 0;
}

output:

Success time: 0 memory: 3468 signal:0

 Consider in a program segment that x = 4, 8 and y = 17.2 = 15.0 i = 2 j = 7 k = 9 Trace all variables (Memory snapshots) along the showing any output at the ap

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site