WELCOME IN THE SEA OF C

Here you find some good quality programs.
If any one want any type of help in C and C++ then you can mail me.
Google

Tuesday, April 29, 2008

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();
}