### Write a C program to generate Pascal’s triangle

Examples to  Pascal’s Triangle  in C Programming using control statements.

You might have studied while studying Binomial Theorem in Mathematics. Read below for the best Information

In mathematics, Pascal’s triangle is a triangular array of the binomial coefficients. In much of the Western world, it is named after the French mathematician Blaise Pascal, although other mathematicians studied it centuries before him in India,

```/* Write a C program to generate Pascal's triangle. */
#include<stdio.h>
#include<conio.h>
void main()
{
int bin,p,q,r,x;
clrscr();
bin=1;
q=0;
printf("Rows you want to input:");
scanf("%d",&r);
printf("\nPascal's Triangle:\n");
while(q<r)
{
for(p=40-3*q;p>0;--p)
printf(" ");
for(x=0;x<=q;++x)
{
if((x==0)||(q==0))
bin=1;
else
bin=(bin*(q-x+1))/x;
printf("%6d",bin);
}
printf("\n");
++q;
}
getch();}``` admin February 18, 2014 0 Comments

### WRITE A PROGRAM TO PERFORM NAÏVE STRING MATCHING admin May 25, 2013 0 Comments

### WRITE A PROGRAM TO PERFORM BREADTH FIRST SEARCH (more…) admin May 25, 2013 0 Comments

### C++ program to perform robin karp string matching

WRITE A PROGRAM TO PERFORM ROBIN KARP STRING MATCHING (more…) admin May 25, 2013 0 Comments

### WRITE A PROGRAM FOR ACTIVITY SELECTOR

```#include<iostream.h>
#include<conio.h>
void main()
{int act,i,j,temp,start,a,k=1,min;
clrscr();
for(i=0;i<7;i++)
a[i]=0;
for(i=0;i<7;i++)
act[i]=i+1;
for(j=0;j<7;j++)
{cout<<"\nEnter the starting time of "<<j+1<<" activity:";
cin>>act[j];
cout<<"Enter the finishing time of "<<j+1<<" activity:";
cin>>act[j];
}
for(i=0;i<7;i++)
{min=act[i];
start=act[i];
temp=i;
for(j=i+1;j<7;j++)
{if(act[j]<min)
{min=act[j];
start=act[j];
temp=j;
}
}
act[temp]=act[i];
act[temp]=act[i];
act[i]=min;
act[i]=start;
}

a=1;
i=0;
for(int m=1;m<7;m++)
{if(act[m]>=act[i])
{a[k]=m+1;
k++;
i=m;
}
}
cout<<"\The activities that can be performed is:";
for(i=0;a[i]!=0;i++)
cout<<a[i]<<" ";
getch();
}``` C++-PROGRAM-FOR-ACTIVITY-SELECTOR admin May 25, 2013 0 Comments

## QUICK SORT admin May 24, 2013 0 Comments