Hi
I've been asked to write a program for this figure
1234
2 3
3 2
4321
I have tried writing this,don't know if its correct or not :?:
my program is
#include <iostream.h>
void main()
{int n,r,c;
cout<<"enter the value of n"<<endl;
cin>>n;
for(r=1;r<=n;r++)
c=r;
cout<<c;
cout<<endl;
for(r=2;r<n;r++)
for(c=2;c<=r;c++)
cout<<c;
for(c=2;c<=n-1;c++)
cout<<" ";
c=r;
cout<<c;
cout<<endl;
for(r=3;r<n;r++)
for(c=3;c<=r;c++)
cout<<c;
for(c=3;c<=r+1;c++)
cout<<" ";
c=r-1;
cout<<c;
cout<<endl;
for(r=4;r<=n;r--)
c=r;
cout<<c;
cout<<endl;
}