+ 1

# int num = 2; int x = 3; if(num >= 2) { if(x > 4) { num = 3; } else { num = 4; } } else {x = 1; }

Kyu iska answer lesson mea 4 bta rha hea Or normal mea no output please btao ear

26th Nov 2022, 10:38 AM
Sourabh Jaiswal
+ 1
Sanskari Launda Gaming num 2 hai to num >= 2 true hoga kynki 2 >= 2 So under jayega aur x > 4 check karega ab x 3 diya hai to 3 > 4 false hoga to else me jayega ab else me 4 num ko assign kar diya hai Jab hum num ko print karenge to 4 aayega
26th Nov 2022, 2:37 PM
AΝ’J
+ 4
Sanskari Launda Gaming No output bata raha hai kynki print nahi kiya hoga Print num cout << num; output will come.
26th Nov 2022, 12:11 PM
AΝ’J
+ 2
Yes output is 4 num >= 2 is true because num is given 2 but x > 4 false because x = 3 so num is 4 means output 4
26th Nov 2022, 10:46 AM
AΝ’J
+ 1
Ok per screen mea ye code dala tuo "no output" output bta rha hea q ?
26th Nov 2022, 11:13 AM
Sourabh Jaiswal
+ 1
Or elseea num =4 ye tuo puch rha hea na num=4 false hoga
26th Nov 2022, 11:14 AM
Sourabh Jaiswal
+ 1
Sanskari Launda Gaming Aisa isliye hai ki Aap ka Code toh Sahi hai aur lesson mein bataya hua iss Code ka Output bhi Sahi hai. Lekin Apke Code mein Screen pr Output Value (jo num variable ki hai) print/display karnewala Command ya instruction likha nahi hai jo bahut jaroori hai, warna apko pata nahi chalega iss code ka output kya hai. I fix Your Code in C programming, See and Run it belowπ https://code.sololearn.com/cWzI8rGtYnjp/?ref=app Aap Yahi Corrected Codeπ C++ mein likh sakte hai, but aap printf() ke bajay c++ mein koi bhi valid Output Command use kijiye aur run kijiye aapko Output Value Screen pr Jaroor Dikhegi. π I hope U will understand.π
27th Nov 2022, 1:19 PM
Rudra
0
Ha sir ap shi ho per mea abhi bhi smja nahi kese 4 ayga
26th Nov 2022, 12:16 PM
Sourabh Jaiswal
0
Is ka matlab ham int ki value if or else mea se change ker skte hea?
26th Nov 2022, 4:02 PM
Sourabh Jaiswal
0
Aribato mjaimas you two rudra or aj muje samjane ke liye ππβ€
27th Nov 2022, 1:28 PM
Sourabh Jaiswal
0
int num = 2; int x = 3; if(num >= 2) // condition is satisfied { if(x > 4) // condition failed { num = 3; } else // goes here { num = 4; } } else // skipped part { x = 1; } // so ans will be // x=3 // num =4
28th Nov 2022, 8:53 AM