i couldn’t come up with the logic and the code . Please give me a detailed description.
Challenge patterns : Pattern mountain
pattern for n no. of rows - 1 1
hey maaz try this code it gave me correct answer
#include
using namespace std;
int main()
{
int i=1,n,j,k,l;
cin>>n;
while(i<=n)
{
for(j=1;j<=i;j++)
{
if(j!=n)
{
cout<<j<<" ";
}
}
for(k=i+1;k<2*n-i;k++)
{
cout<<" "<<" ";
}
int val=i;
for(l=1;l<=i;l++)
{
cout<<val<<" ";
val=val-1;
}cout<<endl;
i=i+1;
}
}