8 Write a program that has a 2 dimensional array of 2 rows 2

8) Write a program that has a 2 dimensional array of 2 rows, 2 columns and as sign 2 5 Use nested loops to output the 2 rows 2 columns

Solution

Hope this will help-

#include <iostream>
using namespace std;

int main () {
   // an array with 2 rows and 2 columns.
   int a[2][2] = { {2,5}, {4,7}};

   // output each array element\'s value                    
   for ( int i = 0; i < 2; i++ )
      for ( int j = 0; j < 2; j++ ) {
         cout << \"a[\" << i << \"][\" << j << \"]: \";
         cout << a[i][j]<< endl;
      }

   return 0;
}

 8) Write a program that has a 2 dimensional array of 2 rows, 2 columns and as sign 2 5 Use nested loops to output the 2 rows 2 columns SolutionHope this will h

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site