Skip to content

Commit

Permalink
Create 2ndoct_zigzag_yash2001340.cpp
Browse files Browse the repository at this point in the history
I created zigzag showing numbers code please accept my merge and add it in your repository
  • Loading branch information
Yash2001340 authored Oct 2, 2021
1 parent dfaf5dc commit 7a1e72f
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions 2ndoct_zigzag_yash2001340.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@

#include <iostream>

using namespace std;

int main()
{
int row,column;
cin>>row>>column;
int sum=(row+column+1)/2;
for(int i=1;i<=row;i++)
{
for(int j=1;j<=column;j++)
{
if(i==j)
{
cout<<i;
}
else if(j==(sum+1-i+1)|| j==(sum+1+i-1))
{
cout<<j;
}
else{
cout<<" ";
}
}
cout<<endl;
}

return 0;
}

0 comments on commit 7a1e72f

Please sign in to comment.