1
1 2 1
1 2 3 2 1
1 2 3 4 3 2 1
1 2 3 4 5 4 3 2 1
1 2 3 4 3 2 1
1 2 3 2 1
1 2 1
1
==========================================================
/*Serial No.51 [swami23.cpp]*/
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,k,n;
clrscr();
printf("Enter the last number for series==>");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
for(j=1;j<=n-i;j++)
printf(" ");
for(k=1;k<=i;k++)
printf("%d",k);
for(k=i-1;k>=1;k--)
printf("%d",k);
printf("\n");
}
for(i=1;i<=n-1;i++)
{
for(j=1;j<=i;j++)
printf(" ");
for(k=1;k<=n-i;k++)
printf("%d",k);
for(k=n-1-i;k>=1;k--)
printf("%d",k);
printf("\n");
}
getch();
}
No comments:
Post a Comment
If you have any doubt, feel free to ask...