View Single Post
Old 16-08-2007, 11:19 PM   #5 (permalink)
xbonez
NP : Crysis
 
xbonez's Avatar
 
Join Date: Mar 2007
Location: City 17
Posts: 1,434
Default Re: Guys help me in C

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();
}
__________________
Gaming: Phenom II x4 965BE @ 3.6Ghz/Corsair H50 Liquid Cooling/MSI 790FX-GD70/2x2GB GSkill Ripjaws 7-7-7-24/3 x GTX 470 w/Zalman VF3000F/Corsair 850W PSU/Antec 1200/2xSpinpoint F3 500Gb RAID 0
xbonez is offline