• 2 months ago
Transcript
00:00Hello everyone, today I am going to explain program of nested if, in nested if there is
00:09a combination of if statement and of if else if, so there is a combination of continuous
00:18if statement and if else if okay, so let us see this program, this is the program in which
00:26I have to display the greatest value okay, out of the three, so here is the program input
00:32three numbers and display the greatest, so I am going to input the three numbers from
00:38the keyboard okay, it's going to store inside three variables and from there it's going
00:44to display the greatest one okay, so let us understand the dry run of it, the program
00:50is going to start, the values are going to store inside A, B and C, suppose if the value
00:56inside A is greater than B and if the value inside A is greater than the value which is
01:02inside in C, in both the cases the condition is true, so it will come to this part and
01:08it's going to print the A okay, now if the value which is inside in A is greater than
01:16B but here the condition get false, the value which is there inside A is what less than
01:22C in that case it's going to print what C, so let us do the dry run, suppose inside A
01:30it is 8, inside B it is 5 and inside C it is 2, so here it will come to the if statement
01:368 greater than 5, yes the condition is true, it will come to the yes part, 8 greater than
01:442, yes the condition is true, it is going to display what 8, again if I run the program
01:52suppose the value inside A is 3, in B is what 8 and C is 2, so here the condition is going
01:58to get false, it will come to the no part and B is going to compare with C, as B is
02:06greater than A, so now the B is going to compare with C, B greater than C, yes the condition
02:12is true, it is going to display the value which is inside in B and then stop, if I again
02:18run the program okay with some different values like in A it is 8, in B is what 5, in C 9,
02:28so 8 greater than 5, yes the condition is true, so it will come to the yes part, A greater
02:35than C, what is inside A, it is 8 and what is inside C, it is 9, here the condition is
02:41false, so it is come to the no part and print C and then stop, in the flowchart I hope you
02:47understand how the things work, in the next video I am going to make the program in C
02:54of nested if, thank you.

Recommended