From 9372913bff2ce6c7690bf759cb0d6d4b3f7471b9 Mon Sep 17 00:00:00 2001 From: shalyavarnika <31516573+shalyavarnika@users.noreply.github.com> Date: Thu, 1 Oct 2020 14:37:14 +0530 Subject: [PATCH] Added Code with proper comments --- Array/PrintWave.cpp | 65 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 Array/PrintWave.cpp 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<