Skip to main content

Posts

Showing posts with the label java program for pascal tringle

How to print the pascal Tringal in a vary the easy way | Print any pattern | Interview Questions

😀If you want to print  pascal Tringal then this  source code for you.😂 import java.util.Scanner; class PascalTringal1  { public static void main(String[] args)  { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); for(int i=0;i<n;i++){            for(int s=0;s<n-i;s++){               System.out.print(" ");     } int val=1; for(int j=0;j<=i;j++){                System.out.print(val+" ");    val=val*(i-j)/(j+1); } System.out.println(); } System.out.println(""); } } Output: