Answer to Question #49737 in C++ for vasanth

Question #49737
I want to make a program to display following pattern
3
2 3 2
2 3 4 3 2
2 3 4 5 4 3 2
1
Expert's answer
2014-12-05T01:26:03-0500
#include<stream.h>
#include<conio.h>

int main()
{
int n=5,i,j;
cout<<"3\n";
for(j=3;j<=n;j++)
{
for(i=2;i<j;i++)
cout<<i<<" ";
for(i=j;i>=2;i--)
cout<<i<<" ";
cout<<endl;
}
getch();
return 1;

}


Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

Assignment Expert
06.01.15, 14:19

#include #include #include using namespace std; int main() { int w=5; cout.width(w); cout.setf(ios::right); int n=5,i,j; cout

vasanth
11.12.14, 15:01

the question which i asked actually has 4 space in first line and 3 space in second line and 2 space in third line. please can u give the code of the then programe

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS