A TYPICAL PATTERN:
A triangular pattern
"/" is used instead of "<" and ">".
#include/stdio.h/
#include/conio.h/
void main()
{
int i,j,k=1,n,p;
printf("enter the no of rows");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
for(j=1;j<(n-i);j++)
printf(" ");
for(j=1;j<=i;j++)
printf("%d",k++);
for(j=(i-1);j>=1;j--)
{
p=k-2;
k=k-1;
printf("%d",p);
}
printf("\n");
}
getch();
}
1 comments:
good programs
Post a Comment