top of page
Search

PASCALS TRIANGLE

  • Writer: Yethikrishna R
    Yethikrishna R
  • Nov 24, 2022
  • 1 min read




public class pascalstriangle{


public static void main(String[]args)

{

int c=1;

{

for(int i=0;i<5;i++)

{

for(int m=1;m<=5-i;m++)

System.out.print(" ");

for(int j=0;j<=i;j++)

{

if (j==0||i==0)

c=1;

else

c=c*(i-j+1)/j;

System.out.print(" "+c);

}

System.out.print("\n");

}

}

}

}



 
 
 

Comments


bottom of page