Write the function ALTERNATE ( int A [ ] [ ] , int n , int m ) to display all alternate elements from 2D array A .
C++ || Class 11
Share
Write the function ALTERNATE ( int A [ ] [ ] , int n , int m ) to display all alternate elements from 2D array A .
C++ || Class 11
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Language using : C++
The function ALTERNATE() goes as follow:
void ALTERNATE ( int A [ ] [ ] , int n , int m )
{
int count=0;
for ( int i = 0 ; i < n ; i++ )
{
for ( int j = 0 ; j < m ; j++ )
{
if ( count%2==0 )
{
cout << A[i][j] << " ";
}
count++;
}
}
}
Example :
9 32 54
5 16 28
6 93 72
Output will be :
9 54 16 6 72
Explanation :
Learn more :
brainly.in/question/1849908
brainly.in/question/16360859