DreamsCoder.com

We Code your Dreams


home > Pascal triangle program in C language




Pascal triangle program in C language









#include
#include
int fact(int x);
void main()
{
int i,j;
clrscr();
	for(i=0;i<=7;i++)
		{
	for(j=0;j<=i;j++)
		{
	printf("%d ",(fact(i)/(fact(j)*fact(i-j))));
		}
	printf("\n");
	}
	getch();
}

int fact(int x)
{
	if(x>0)
	return(x*fact(x-1));
	else
	return 1;
}

Label - c





by - Chinmay Mahajan





Are you looking for something else?


Suggested Programs




Spinning letters in using C - graphics


What is the difference between ARRAY and STACK?


Displaying Matrix in C


Pascal triangle program in C language