c/c++ pattern printing program using for/while loop

c/c++ pattern printing program using for/while loop

Write a program to print following pattern in C/C++.
1
12
123
1234
12345
1234
123
12
1


#include<stdio.h>
#include<conio.h>
#include<iostream.h>
int main()
{
for(int i=1;i<=5;i++)
{
for(int j=1; j<=i;j++)
{
cout<<j;

}

cout<<”n”;
}
//now print lower part of pattern
for(int i=4;i>0;i–)
{
for(int j=1; j<=i;j++)
{
cout<<i;
cout<<”n”;
}
getch();
return 0;
}

pattern