Tweet
/* Program to print sequence
1
121
12321
1234321
12321
121
1
*/
#include<stdio.h>
#include<iostream>
main()
{
int i,j,k,p=4;
for(i=1;i<=4;i++)
{
for(k=1;k<=p;k++)
std::cout<<" ";
p--;
for(j=1;j<=i;j++)
std::cout<<j;
for(j=i-1;j>=1;j--)
std::cout<<j;
std::cout<<"\n";
}
p=2;
for(i=3;i>=1;i--)
{
for(k=1;k<=p;k++)
std::cout<<" ";
p++;
for(j=1;j<=i;j++)
std::cout<<j;
for(j=i-1;j>=1;j--)
std::cout<<j;
std::cout<<"\n";
}
}
Program to print number sequence in C++ (3)
Posted by
LAHAUL SETH
~
Program to print number sequence in C++ (3)
2012-05-01T12:37:00+05:30
LAHAUL SETH
C++
|
cplusplus
|
Comments
Program to print number sequence in C++ (3)
2012-05-01T12:37:00+05:30
LAHAUL SETH
C++
|
cplusplus
|