diff --git a/Array/PrintWave.cpp b/Array/PrintWave.cpp new file mode 100644 index 0000000..b2777ac --- /dev/null +++ b/Array/PrintWave.cpp @@ -0,0 +1,65 @@ +// Given a 2D array. Print the elements of the array in a wave form row-wise and columnwise. + +// For example if the array is given as: +// 1 2 3 4 +// 5 6 7 8 +// 9 10 11 12 +// 13 14 15 16 + +// Row-wise O/P: 1,2,3,4,8,7,6,5,9,10,11,12,16,15,14,13 +// Column-wise O/P: 1,5,9,13,14,10,6,2,3,7,11,15,16,12,8,4 + +#include +using namespace std; + +void row_wise(int a[][100], int n, int m){ + for(int i=0;i=0; j--){ + cout<=0 ;i--){ + cout<>n>>m; + int a[100][100] = {0}; + for(int i=0;i>a[i][j]; + } + } + + row_wise(a,n,m); + cout<