2)this is the answer:
Code:
#include<conio.h>
#include<stdio.h>
void main()
{
int i,j,k,before=0,array[10][10];
clrscr();
for(i=1;i<=5;i++)
{
for(j=1;j<=(2*i);j++)
{
if(j<=i)
{
array[i][j]=before+1;
before++;
}
else
{
array[i][j]=before-1;
before--;
}
}
before=0;
}
for(i=1;i<=5;i++)
{
for(j=1;j<=((2*i)-1);j++)
{
printf("%d",array[i][j]);
printf("\t");
}
printf("\n");
}
getch();
}

Last edited by shabbir; 1Jun2009 at 10:04.. Reason: Code blocks
abhix95 like this