# include<stdio.h>
# include<conio.h>
1
23
4 5 6
4 5 6
2 3
1
void main()
{
int y,n=3,i,j,k=1;
clrscr();
for(i=1;i<=n;i++)
{
for(j=1;j<=i;j++)
{
printf("%d ",k++);
}
printf("\n");
}
k-=n;
//printf("\n%d",k);
for(i=n;i>=1;i--)
{
for(j=1;j<=i;j++)
{
printf("%d ",k++);
}
k--;
k=k-((i-1)*2);
printf("\n");
}
}
# include<conio.h>
1
23
4 5 6
4 5 6
2 3
1
void main()
{
int y,n=3,i,j,k=1;
clrscr();
for(i=1;i<=n;i++)
{
for(j=1;j<=i;j++)
{
printf("%d ",k++);
}
printf("\n");
}
k-=n;
//printf("\n%d",k);
for(i=n;i>=1;i--)
{
for(j=1;j<=i;j++)
{
printf("%d ",k++);
}
k--;
k=k-((i-1)*2);
printf("\n");
}
}
No comments:
Post a Comment