Saturday, 26 January 2019

Pascal Triangle

Q: Write a program to make pascal triangle ?

Answer :

Pascal Triangle :

Pascal's Triangle is more than just a big triangle of numbers. There are two major areas where Pascal's Triangle is used, in Algebra and in Probability / Combinatorics.


  1. At the top center rach number will be “1.”
  2. On the next row write two 1’s, forming a triangle.
  3. On each next row start and end with 1’s and compute each interior term by adding the two numbers above it.

Code : 

import java.util.*;
public class pascal
    static void sop(String ar)
   public static void main(String args[])
       int i,j,L,sp,number;
       Scanner sc=new Scanner(;
       sop("Enter triangle size");
            System.out.print(" ");
               System.out.print(number +" ");


No comments:

Post a comment