Pascal Triangle In C Using For Loop Tamil


/*
        1
       1 1
      1 2 1
     1 3 3 1
    1 4 6 4 1
*/
#include<stdio.h>
#include<conio.h>
long int fact(int);
void main()
{
	int n,i,j;
	clrscr();
	printf("\nEnter the limit :");
	scanf("%d",&n);
	for(i=0;i<=n;i++)
	{
	   for(j=0;j<=n-i;j++)
	   {
		printf(" ");
	   }
	   for(j=0;j<=i;j++)
	   {
		printf(" %d",fact(i)/(fact(j)*fact(i-j)));
	   }
	   printf("\n");
	}

	getch();
}
long int fact(int n)
{
  int f=1,i;
  for(i=1;i<=n;i++)
  {
	f=f*i;
  }
  return (f);
}


Login To Download Source Code

Leave a Comment:

Login To Comment

List Of Programs


Goto Examples

Operators

Looping

Number Conversion

Pattern Design

Arrays

Matrix Examples

Sorting Examples

String Function

Change Case

String In C

Maths Functions

User Defined Functions

Recursive Functions

Pointer

Structure

File Concept

Calender Programming