Program for Pascal Triangle in C and C++

Here I have shared simple program for pascal triangle in C and C++.

Basically Pascal’s triangle is a triangular array of binomial coefficients. An example for how pascal triangle is generated is illustrated in below image. If you have any doubts then you can ask it in comment section.

Each number is the sum of the two directly above it.

Pascal Triangle Animated

 

Program for Pascal Triangle in C

 

Program for Pascal Triangle in C++

 

Output

Program for Pascal Triangle in C and C++

4 thoughts on “Program for Pascal Triangle in C and C++

  1. LORD ADARSH

    palindrome nos. are those nos. whose reverse is same ….crazy programmer is my program right … i mean can i get full marks for it in exam as it works.. |
    |
    v
    in dev c++ reply me
    see it
    0)=================>
    #include
    int main()
    { using namespace std;
    int a,b,c,j,f;
    cout<<" enter a no. at hundred no."<<"\n"
    <<"enter a no. at tense place "<<"\n"
    <<"enter a nos. at unit place "<>a>>b>>c;
    j=a*100+b*10+c;
    cout<<" the entered nos. is "<< j<<"\n";
    f=c*100+b*10+a;
    cout<<" the reverse nos. is "<<f;
    if(j==f)
    {
    cout<<"\n"<<" as we can see its palindrome number";
    }
    else
    {
    cout<<"\n"<<" as we can see it is not palindrome";
    }
    return 0;
    }

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *