here this will give proper ouput.
but it is C++. u just need to tweak it a little bit. replace the cout and cin commands with printf and scanf respectively
Code:
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int i,j,n;
cout<<"\n\nEnter limit-->\t";
cin>>n;
for (i=1;i<=n;i++)
{
for (j=1;j<=n-i;j++)
cout<<" ";
for (j=1;j<=i;j++)
cout<<j;
cout<<endl;
}
for (i=1;i<=n;i++)
{
for (j=1;j<=i;j++)
cout<<" ";
for (j=1;j<=n-i;j++)
cout<<j;
cout<<endl;
}
getch();
}