Java code for Printing Pascal Triangle

  Рет қаралды 59,607

TrainingMug

TrainingMug

Күн бұрын

This program demonstrates the logic and code for Printing Pascal Triangle. Pascal Triangle prints the numbers in the following order
1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
This program gives hands on nested for loops.
If you like this video, don't forget to subscribe , like and share this video
Please promote this channel , by sharing it with your friends who are searching / preparing for IT jobs in programming..
If you have any coding challenges ( questions ) , post them in the comment, we will upload the videos for the same

Пікірлер: 28
@dmdeepakmittal
@dmdeepakmittal 4 жыл бұрын
After searching a lot I find trigular format solution here. I implemented the same thing in scala. Appreciate your help. Thanks!
@nada22637
@nada22637 3 жыл бұрын
Do you understand this equation ?
@abhaykumar4680
@abhaykumar4680 Жыл бұрын
I spent three days in finding a better understandable solution of pascal triangle finally i got this video
@nizharfan
@nizharfan 3 жыл бұрын
THANK YOU SIR, RESPECT! now i can do my assignment :') keep it up!
@luismiguelhurtadoarias2225
@luismiguelhurtadoarias2225 Жыл бұрын
Thank You i learned too much with your help.
@ramkrishnak6371
@ramkrishnak6371 21 күн бұрын
class Solution(object): def generate(self, numRows): my_list=[] prev_list=[] prev_list.append(1) if numRows==1: return [prev_list] else: for i in range(0,numRows): list1=[] for j in range(0,i): if j==0: list1.append(1) else: list1.append(prev_list[j]+prev_list[j-1]) list1.append(1) prev_list=list1 my_list.append(list1) return my_list try this
@sarithareddy4929
@sarithareddy4929 3 жыл бұрын
Sir I can clearly understand ur teaching please explain some more topics...
@nadaayman8939
@nadaayman8939 3 жыл бұрын
i don,t understand how the equation i-j/i+j work beacaue i and j increment at the time
@gschowdareddy4456
@gschowdareddy4456 5 жыл бұрын
Thankyou very much for explaining
@CSSANJAYR
@CSSANJAYR 2 жыл бұрын
but the doubt over here is you are incrementing the spaces in every traversal as well as decrementing it then how come it may give you a proper triangle order?
@divyanshkumar5053
@divyanshkumar5053 2 жыл бұрын
it works💥💥
@blackrose0841
@blackrose0841 4 жыл бұрын
Plz make a video on reverse a full sentence word by word eg. Sky is blue to blue is sky in java plz .. ..make a video on it
@prvizpirizaditweb2324
@prvizpirizaditweb2324 3 жыл бұрын
in the first iteration i and j both are zero th number should be zer o
@saini1855
@saini1855 2 жыл бұрын
i am getting confused in this part😵‍💫😵‍💫
@Franky27968
@Franky27968 10 ай бұрын
See , you are first displaying the number, then calculating the next number (in the index of the first number) 1st iteration number = 1 is displayed first (2nd number is calculated but loop runs only once, so not displayed) 2nd iteration number = 1 is displayed first, 2nd number is calculated in the same index which comes out to be 1 (i -> 1, j -> 0) 3rd iteration number = 1 is displayed first, 2nd number is calculated in the same index which comes out to be 2 (i- > 2, j -> 0) and same for 3rd number
@SuperICHmagdich
@SuperICHmagdich 6 жыл бұрын
It wont display properly when numbers get to 3 digit length but nice compact solution
@shweta7362
@shweta7362 3 жыл бұрын
Thank you sir🙌✨
@rdr6858
@rdr6858 3 жыл бұрын
Thank You Sir!
@shahriarmim4696
@shahriarmim4696 6 жыл бұрын
I have little bit of problem with this formula. Actually it's against the standard and conventional programming. Because it has spilled values. when you have j=2 and i = 3 your formula turns out number = number * (3-2)/(2+1) ==> number = number * (1)/(3) ==> number = number * 0.33 though int/int show integer value 0.. this is against a good programming.
@gameskingdom3224
@gameskingdom3224 5 жыл бұрын
Can you do 2D array for the same example
@importantterms9850
@importantterms9850 2 жыл бұрын
How to generate these formula
@bbibek1
@bbibek1 6 жыл бұрын
superbbbb..SIR..
@amarjitdasuya
@amarjitdasuya 6 жыл бұрын
thx
@AK-tt7fc
@AK-tt7fc 2 жыл бұрын
Working
@shankardsb.e5397
@shankardsb.e5397 4 жыл бұрын
sir how to install eclipse ?
@prudhvikanthbezawada2794
@prudhvikanthbezawada2794 3 жыл бұрын
not working for 6 lines
@JonathanGarcia-hc1dt
@JonathanGarcia-hc1dt 6 жыл бұрын
You save me 😅😅
Java program to print Pascal Triangle
18:05
QAFox
Рет қаралды 16 М.
Java code for Converting Decimal Number to Binary Number
14:50
TrainingMug
Рет қаралды 13 М.
Win This Dodgeball Game or DIE…
00:36
Alan Chikin Chow
Рет қаралды 45 МЛН
She's very CREATIVE💡💦 #camping #survival #bushcraft #outdoors #lifehack
00:26
Офицер, я всё объясню
01:00
История одного вокалиста
Рет қаралды 6 МЛН
Java Program to Print Floyd's Triangle
13:45
TrainingMug
Рет қаралды 3,5 М.
Java code for Printing Multiplication Table from 1 to 10
9:27
TrainingMug
Рет қаралды 12 М.
How to solve any Star Pattern Program
18:47
Simply Coding
Рет қаралды 1,2 МЛН
Pascal Triangle | Finding nCr in minimal time
26:45
take U forward
Рет қаралды 259 М.
Learn Any Programming Language In 3 Hours!
22:37
Code With Huw
Рет қаралды 441 М.
Fibonacci Series In Java With Recursion - Full Tutorial (FAST Algorithm)
15:11
Solve Any Pattern Question With This Trick!
57:20
Kunal Kushwaha
Рет қаралды 2,4 МЛН
Learn Java in 14 Minutes (seriously)
14:00
Alex Lee
Рет қаралды 4,8 МЛН