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;
}
Dave Sinkula commented: Use code tags. +0

This isn't a tutorial...

What does YOUR program output?

Also, you can use the code symbols to make the code more readable; they are:

[ <the word 'CODE'> ]
insert your code here
[ <a slash '/'> <the word 'CODE'> ]

Otherwise its pretty hard to follow all those nested for loops!

What does YOUR program output?

Also, you can use the code symbols to make the code more readable; they are:

[ <the word 'CODE'> ]
insert your code here
[ <a slash '/'> <the word 'CODE'> ]

Otherwise its pretty hard to follow all those nested for loops!

yeah, code tags look like this:

[code] your code goes here
[/code]

Note: looking at the editing of the posts, there's not any actual indentation in there that I can see...