Look at the following C++ code and find the possible output(s) from the options (i) to (iv) following it. Also, write the maximum values that can be assigned to each of the variables R and C.
Note:
● Assume all the required header files are already being included in the code.
● The function random(n) generates an integer between 0 and n-1
void main()
{
randomize();
int R=random(3),C=random(4);
int MAT[3][3] = {{10,20,30},{20,30,40},{30,40,50}};
for(int I=0; I<R; I++)
{
for(int J=0; J<C; J++)
cout<<MAT[I][J]<<' ';
cout<<endl;
}
}
(i) | (ii) |
10,20,30 20,30,40 30,40,50 |
10,20,30 20,30,40 |
(iii) | (iv) |
10,20 20,30 |
10,20 20,30 30,40 |
(ii) and (iii)
Max Value of R:2
Max Value of C:3