Ans will be 65. Explanation: lets break the problem into part (1) At first the condition is sizeof(var) if this condition is evaluated to be true then (var2>23 ? ((var==75) ? 'A' : 0) : 0) will be returned if false then 0 will be returned As we know sizeof() is an unary operator which returns how many byte a datatype can hold as var is an variable of integer data type , sizeof(var) will either return 2 or 4 as machine to machine int vary . We know every number except 0 is evaluated to be true. So (var2>23 ? ((var==75) ? 'A' : 0) : 0) it will returned (2)next the condition is (var2>23) if this condition is evaluated to be true then ((var==75) ? 'A' : 0) will be returned if false then 0 will be returned as we know 56>23 is true then ((var==75) ? 'A' : 0) will be returned. (3)the condition is (var==75) if this condition is evaluated to be true then 'A' will be returned if false then 0 will be returned As 75==75 then 'A' will be returned and stored into num variable As c support auto type casting so int can store char. In the final printf function we use the placeholder %d and it print integer value . According to Ascii integer value of 'A' is 65 So the output will be 65.
@daytrade10134 жыл бұрын
Thank you
@harshmk10524 жыл бұрын
Thanks a lot :)
@mehadihasansanto5384 жыл бұрын
Why don't you think that ((var==75)? 'A' : 0) will be evaluated first? [As we know that bracket has the highest precedence than any other operator in C.]
@ayushvats18084 жыл бұрын
@@mehadihasansanto538 xactly this is my doubt and i think bracket will only be evaluated first
@mehadihasansanto5384 жыл бұрын
@@ayushvats1808 Yeah, Brother. I also think so. Moreover, the associativity of conditional operator(? :) works from right to left. That's why I think ((var == 75)? 'A' : 0) will be evaluated first.
@102ayushkumar34 жыл бұрын
Answer -> 65 Solution -> num = sizeof(var) ? (var2 > 23 ? ((var == 75) ? 'A' : 0) : 0) : 0; as we know, var==75 is True, therefore, (var == 75) ? 'A' : 0 will be equal to 'A'. Then we will replace the equation with 'A' in the main equation. num = sizeof(var) ? (var2 > 23 ? 'A' : 0) : 0; as we know, var2 == 56, hence greater than 23, therefore, var2 > 23 ? 'A' : 0 will be equal to 'A'. Then we will replace the equation with 'A' in the main equation. num = sizeof(var) ? 'A' : 0; as we know, as condition is True if the result of expression is any number except 0, sizeof(var) == 4, as its an integer data type. sizeof(var) is a True statement, therefore, sizeof(var) ? 'A' : 0 will be equal to 'A'. This implies num = 'A'; In the printf statement, the format specifier of num is %d, so the ASCII value of the character will be printed. ASCII value of 'A' = 65.
@acoinhastwosides5239 Жыл бұрын
You make it understandable. You remove my confusion to explain it line by line. Thax
@pranaylambat97435 жыл бұрын
O/p is 65 ... because all three condition are true...sizeof(var) Shows the size of int (which is other than 0 ....and then after all condition are executed it will return A and the decimal of A is 65 .. according to ASCII TABLE
@Gautamsingh-dy4cp5 жыл бұрын
But here parenthesis is given first evaluate parenthesis then applied conditional ..
@saiyadav50145 жыл бұрын
By evaluating with the parentheses the answer will be A. But in what manner computer will execute.?
@kajolnimesh4835 жыл бұрын
@@saiyadav5014 Answer should A for sure as all the conditions are true, but compiler should execute A as a integer value as it is assigned to num variable that is integer variable.
@sairakeshdurga6004 жыл бұрын
tq bro
@udaykumar-es2el3 жыл бұрын
@@Gautamsingh-dy4cp but as for associvity rule it caan be done from left to right
@randomthief78385 жыл бұрын
Interesting lectures and also they are making to think for every homework questions.
@millenmarbun246 жыл бұрын
it will be wayyy better if you can explain the homework problems @nesoacademy sometimes I can't fully comprehend the answers
@creative_editzs18625 жыл бұрын
yes
@sarthak_jain_515154 жыл бұрын
Yes
@brocklesnarufcchamp14 жыл бұрын
Yeah, that would be really nice :(
@AK--vc9wd3 жыл бұрын
65
@kanthurijaswanthroyal56852 жыл бұрын
@@AK--vc9wd I to get the same answer
@wajahatriazmirza4 жыл бұрын
The answer is 65 First we will solve the inner brackets. According to that our condition is true so it will store the corresponding value of A according to ASCII i.e. 65 (because we are dealing with integer datatype). Then we will work our way out solving the outer brackets one by one. Hence the final answer is 65.
@ahmedsedeek28145 жыл бұрын
okay guys , here is the point .. if we considered it as an if statement , it'll be as following ; ) int var = 75 , var2 = 65; int num ; if(sizeof(var)) { if(var2 > 23) { if(var == 75) { num = 'A'; } } printf("%d" , num); } else return 0; the output is gonna be 65 , and this is according to ASCII table , as 'A' is = 65 ..
@khalilrin-ju3nm5 жыл бұрын
thank you very much for explanation Mr Sedeek. If you do not mind i will ask you questions in future too
@nbk3304 жыл бұрын
by looking at this equation now i understood the last stage of the problem clearly
@ekanshkhanulia40784 жыл бұрын
Please make your own videos,no gyan choding here
@Gaurav-zh4pm3 жыл бұрын
else statements biro ?
@pavanroyal81833 жыл бұрын
Var 2 is 56 .how u right 65?
@justindenison70294 жыл бұрын
Output will be the ASCI code of 'A' =65; Thank you for your efforts, I like your explanation so much ❤
@sowmithb46732 жыл бұрын
thanks bro
@soumi67202 жыл бұрын
hands down this is the best channel . pls continue blessing us with valuable information.
@satishsgm01573 жыл бұрын
First rule to be followed while solving these type of conditions is: First of all we need to divide given expression into three parts i.e L|M|R And then start evaluate each and expression. Al last num variable initialised by A which is equivalent of 65.
@rsingh62164 жыл бұрын
This question is like 10 questions in one question. Neso team is great.
@gautam18013 жыл бұрын
Thanks for teaching me something in 5 minutes that my teacher took two 50 minutes classes for! 😃😃
@kunalkhallar9699 Жыл бұрын
I think that's the main reason, why does our education system lag behind.
@sumit4789 Жыл бұрын
true uncle@@kunalkhallar9699
@bengalisareeshubstore36333 жыл бұрын
Result is 65, start to solve from the inner bracket to the outer bracket, fixed inputs and take care of format specifier used during output, it will convert the result A into ASCII decimal 65 (%d is used for output)
@98_shubhamr.sharma783 жыл бұрын
Sir please solve homework problems also so that we can give it a try and if we are not able to solve it then we can refer to your explanation that would really really be helpful for beginners like me and all would really appreciate that effort of yours!!!! 🙏🙏🙏🙏
@jayap83554 жыл бұрын
O/p - ASCII Value of A= 65 Explained it perfectly man!!!!
@shashankpandey64284 жыл бұрын
Thanks a lot for videos sir ❣️. It's really helpful.
@APstudent-y6s11 ай бұрын
5:22 o/p is 65 thanks a bunch to the tutor n nesoAcademy ❤🙏
@AYUSHSINGH-pv3pl3 жыл бұрын
#solution #include int main() { int var=75,var2=56,num; num=sizeof(var)?(var>23? ((var==75)?'A':0):0):0; printf(" the num is :%d",num); return 0; } output=65
@helloHima7904 жыл бұрын
65 since sizeof var is 4or 8 according to processor which is True in boolean form and ascii value of A is 65 as we need to print in integer the value.
@aniketnandi74786 жыл бұрын
*/Output will be*/ 65 as per the expression, the result will be 'A' and it will be stored in num. But, num is int type data So, 'A' will be converted to its corresponding ASCII value which is 65.
@Tejaswini01212 Жыл бұрын
Ans of H.W:It will print 65 that means the o/p of code is 'A' 65 is a ASCII value of capital 'A'.
@sumanroy46154 жыл бұрын
Ans will be 65 because the return value of 'num' is equal to 'A' according to ASCII table the value of A is 65.
@otetumooluwaseun3948 Жыл бұрын
All other inner conditional expressions will be treated first. They return true. Then, the main operand, sizeof, returns true which implies 'A' will be returned. Since %d specifier was used, the printf will print the decimal value of character A, which is 65.
@pramodinireddy15533 жыл бұрын
Your classes are amazing sir , the way you explain with examples makes us more easier to understand the topics .
@davidebenedettivalentini181211 ай бұрын
Easy explanation of last exercise: Remember that Expression1 ? Expression 2 : Expression 3 means: if Expression1 is True return Expression 2, else return Expression 3 so rephrasing the exercise we get: if (sizeof(var) is True return (if (var2 > 23) is True return ( if var == 75 return 'A' else return 0) else return 0) else return 0. Now just remember var is int and sizeof(int) returns 4 (which C reads as True) and ascii code of 'A' is 65 (i read it from other answers)
@harshantbaraiya4712 Жыл бұрын
int var = 75; declares and initializes an integer variable var with the value 75. int var2 = 56; declares and initializes another integer variable var2 with the value 56. int num; declares an integer variable num without initializing it. Now, let's analyze the following line: num = sizeof(var) ? (var2 > 23 ? ((var == 75) ? 'A' : 0) : 0) : 0; This line uses nested conditional operators to assign a value to num based on several conditions: sizeof(var) calculates the size of the var variable, which is 4 bytes (assuming a typical 32-bit system). var2 > 23 checks if var2 is greater than 23, which is true because var2 is 56. (var == 75) ? 'A' : 0 checks if var is equal to 75. If it is, it assigns the character 'A' to num; otherwise, it assigns 0. So, the value of num will be 'A' because both sizeof(var) and var2 > 23 are true, and var is indeed equal to 75. Finally, the code prints the value of num using printf, which will output 'A' as a character (ASCII value of 'A' is 65). Therefore, the output of this code will be: A
@tufanchakraborty59254 жыл бұрын
65 Tip: use different bracket such as {}()
@cirobermudez6 жыл бұрын
The output of the programa is A, because as sizeof(var) is diferent to 0 it enters to the first true statement, then it checks if var2 > 23, that is true, so finally checks it var == 75, again this is true so num equal to A
@cirobermudez6 жыл бұрын
Lakshman Patel, thanks
@ankurdutta56415 жыл бұрын
@@lakshmanpatelofficial but why is 65 ?
@SerajAlhorany4 ай бұрын
@@ankurdutta5641 A = 65 according to ASCll
@HDP764 жыл бұрын
Out put will be 65 Since program execution begins from main function Declared variable var and assigned 75 to it Declared another variable var2 and assigned 56 to it Declared num integer type And given condition sizeof is unary operator since given sizeof(int) it returns 2 or 4 bytes depends on the compiler machine.How many bytes int will occupy it returns We know that if the condition is false it returns 0 and other than 0 returns 1 so now our condition is true it checks other condition of that true it checks other condition finally it returns A and num is assigned with A and it will be printed since the value of A according to ASCII in c is 65
@ashishtayade047 Жыл бұрын
Thank you sir very nice gide & very nice best information conditional operator teaching video.👍
@abhijit22314 жыл бұрын
Output will be ASCII value of 'A' ie. 65
@reginahshikanda6478 Жыл бұрын
Answer is 65 , thank you so much for this lectures
@mislead10703 жыл бұрын
The ans is 65 i.e. Numerical equivalent of the letter A. Explaination: The first condition/expression will return the size of var which is ofcourse more than 0, and as we all know, any value other than 0 is said to be true, so hence, the next expression will get terminated, which is again true... Bec var2 i.e. 56 > 23, thus the next expression will get terminated which i again true as we can see the value of var is 75, So thus, being true it will again terminate the true statement, But this time, there is no condition and its just a letter 'A', So as it being the last one of the conditions, the 'A' will get stored in num And as we know, ("%d") prints numerical values, so even if we store alphabetical values, it will convert the alphabetical value to its Numerical equivalent according to the ASCII Table and thus we will be getting the output as 'A' i.e. 65.
@fahimarian22646 жыл бұрын
Output will be : 65
@aldaiansaklain6 ай бұрын
Really awesome classes.
@sachinkumbar37894 жыл бұрын
It will print output as a 65 which is ASCII equivalent of 'A'
@deepeshsunuwar10864 жыл бұрын
all the three boolean returns true value so the value of num is "A" then the ASCII value of A is printed. so the final answer will be 65...........
@sdk283 жыл бұрын
Steps occured: 1. num = sizeof(var) ? (var > 23 ? ((var == 75) ? 'A' : 0) : 0) : 0; 2. num = sizeof(var) ? (var > 23 ? ('A') : 0) : 0; 3. num = sizeof(var) ? (('A')) : 0; 4. num = (('A')); Thus, num = 65 (when expressed in integer format)
@ssenapati33285 жыл бұрын
Pls tell the ans with ur explain @neso academy.. All doute are clear
@adityajayswal13033 жыл бұрын
65 or wot blissed lectures.....
@Kim_jong_un692 жыл бұрын
Will print 65 because 65 is the ASCII value of A if you use print("%c", num); instead of %d you will get A.
@AsteriskYoutube4 жыл бұрын
Sir I’m studying only 10th standard but learning c from u thanks a lot sir and I got the answer for ur homework problem as 0 if wrong plz explain by replying to me
@ravindra_sings_3 жыл бұрын
ans is 65
@ravindra_sings_3 жыл бұрын
Ans will be 65. Explanation: lets break the problem into part (1) At first the condition is sizeof(var) if this condition is evaluated to be true then (var2>23 ? ((var==75) ? 'A' : 0) : 0) will be returned if false then 0 will be returned As we know sizeof() is an unary operator which returns how many byte a datatype can hold as var is an variable of integer data type , sizeof(var) will either return 2 or 4 as machine to machine int vary . We know every number except 0 is evaluated to be true. So (var2>23 ? ((var==75) ? 'A' : 0) : 0) it will returned (2)next the condition is (var2>23) if this condition is evaluated to be true then ((var==75) ? 'A' : 0) will be returned if false then 0 will be returned as we know 56>23 is true then ((var==75) ? 'A' : 0) will be returned. (3)the condition is (var==75) if this condition is evaluated to be true then 'A' will be returned if false then 0 will be returned As 75==75 then 'A' will be returned and stored into num variable As c support auto type casting so int can store char. In the final printf function we use the placeholder %d and it print integer value . According to Ascii integer value of 'A' is 65 So the output will be 65.Ans will be 65.
@Xero752 жыл бұрын
Great job kn explaining this! Thank you 😊 soo much
@vittorio97632 жыл бұрын
Output is 65, the decimal value of A
@NMAJJINEERAJA4 жыл бұрын
ASCII code of 'A' will be the answer and that is 65
@AbhinavKumar-qv7to2 жыл бұрын
65 ans because 'A' will be stored in num and due to %d it will be printed in ascii encoding equivalent 65.
@akritibhan58583 жыл бұрын
questions are just amazing..
@brotherinterest69122 жыл бұрын
so as i think that we have break it inside the bracket (var==75)?'A':0 then the answer is A because 75 is equal to 75. then, (var2>23?'A':0) then the answer will be A because 56 is greater than 23. then, we have sizeof(var)?'A':0; then the ascii A will be implemented that is 65
@Sekhar_Home4 жыл бұрын
Thnx . U have given me a best lecture
@mechguy04043 жыл бұрын
the answer will be 65, the ASCII value of 'A'. As each of the three statements is true so expression 2 of each statement will be the outcome.
@andistheinforitbutso75133 жыл бұрын
Good morning 🙏 🌄
@venkatesh34395 жыл бұрын
Var==75 true A Var2>23 true A Sizeof(var) 4 non zero true A A is character we are using %d A ASCII value 65
@manalkhazraj5 жыл бұрын
But how could the size of var be A?
@balaagisp84904 жыл бұрын
Ans is A because all 3 statement is true and if true the ans is A. But in printf it's %d which is integer and value of A is 65 in decimal so Final ans = 65
@raiderpsk96908 ай бұрын
'A' is implicitly convert to int to become 65
@ahmedmomtaz86963 жыл бұрын
The answer 65 From inside out ((Var==75)?’A’:0 True. ‘A’. Then Var2>23?’A’:0. True. ‘A’ then Sizeof(var) ?’A’:0. True. ‘A’ Nume=‘A’ Nume=65
@Dwarika_Sahu5 жыл бұрын
Thank you so much for this information
@Rest_leave4 жыл бұрын
Whole expression is true that's by it has to return 65(at the place of A because c supports auto casting).
@unaib76765 жыл бұрын
65 because all conditions are true hence variable contain A and in decimal it will be 65
@md.hasanmahmud4162 жыл бұрын
//We can think just like that if (sizeof(var)) { // 4 = true so go inside if(var2>23) { // 56>23=true so go inside if (var==75) { //var=var= true so go inside num='A'; // Final 'A' will assign in num else num=0; } else num=0; } else num=0; }
@VijayKumar-tp9ux Жыл бұрын
Nice steps bro👏
@waterford77362 жыл бұрын
Excellent👍
@nexrainlyrical78763 жыл бұрын
answer --> 51 explanation a=7; a^=5--> a=a^5--> a=2 printf("%d",a+=3)--> a+=3-->a=a+3--->a=5; printf("%d",printf(printf("%d",a+=3));------->51 ans only one character is there so 1 will be printed after 5..
@balaagisp84904 жыл бұрын
Ans A ASCII value of A is 65
@duconsao37683 жыл бұрын
what is the definition of tenary operator 3:28
@sajooj79483 жыл бұрын
can you determine the size of on your own without using the sizeof() operator? is it like a rule where int is always 4? And do we start solving the expression from the parenthese on the inside or outside first?
@randomthief78385 жыл бұрын
65 stand for character A All the conditions are true.
@goutamvohra34424 жыл бұрын
Ans is A but the return value is in the form of int datatype then it will transform into ASCII format return the value of A is 65 So the output is 65
@sanyagandhi65764 жыл бұрын
size of var is something other than 0 therefore, the condition is going to be true and A will be printed.
@gauravvaidya18684 жыл бұрын
There is %d which is decimal placeholder therefore it's ASCII value will be printed which is 65
@nagasubramanian8753 жыл бұрын
Let me make it easier Expression is: Sizeof(var)?(var2>23?((var==75)'A':0):0):0 Now let's separate into 3 segments 1st (var==75)?'A':0 2nd (var2>23)?'A':0 3rd sizeof(var)?'A':0 Ans for 1: 75==75 so A is returned Ans for 2:. 2>23 so A is returned Ans for 3: A A is output and the ASCII value of A is 65
@happy_girls2 жыл бұрын
👍👍👍🥰
@rsingh62164 жыл бұрын
I solved in first attempt , before this playlist ,i used to write stdio.h to studio.h
@agamgill95636 жыл бұрын
Numeric value of a return 65
@sirnoxy25342 жыл бұрын
Hurray!! Got the answer in just one go! BTW ans is 65.
@AbbaJi-gm4vc5 жыл бұрын
Sir please give the solution video also so that we can compare our result
@gauravjoshi48654 жыл бұрын
65 ASCII code of "A"
@ritiksaxenaofficial5 жыл бұрын
Output is 65...ascii of A
@anandkumar-bd2ru2 жыл бұрын
65. // Ascii value of 'A'
@porankirajkumar47092 жыл бұрын
As the variable num is of data type integer how can it take of char 'A' as its value and print 65 in integer
@anjani_tiwari Жыл бұрын
int var = 75; int var2 = 56; int num; num = sizeof(var) ? (var2 > 23 ? ((var == 75) ? 'A' : 0) : 0) : 0; num = sizeof(var) ? 'A' : 0; num = sizeof(var) ? 'A' : 0; num = 65
@JackVaileon11 ай бұрын
I wonder if we can solve not from inner bracket but from the outer bracket, in this HW, both conditions are the same.
@chinua25183 жыл бұрын
answer is A, since all conditions happen to be true in all tested case.
@xiaoshan97223 жыл бұрын
the num = A ,but the output should be decimal number, then it convert to its binary representation 65
@Gautamsingh-dy4cp5 жыл бұрын
Sir firstly applied parenthesis operation after that apply ternary operator..first offl all remove parenthesis then evaluate ..it true or not
@hikmathasanov3 жыл бұрын
65 will be printed, since it is the decimal value of character A.
@saeedakther70232 жыл бұрын
Please explain again condition operation
@the_mitwa Жыл бұрын
Which ternary operator gets evaluated first?
@vishalyadav0673 жыл бұрын
Output is 'A', how A become 65 ,pls anyone explain me.....???ohhh i gotted because be are storing value of char data type in int data type as a answer.....if we are using char num .....than answer is A .....👍👍🙏 Char Value of A to Z in int value A=65 B=66 C=67 D=68 So on...
@AbdElrahmanAmirMohamed4 жыл бұрын
answer = 65 .... this is the decimal number parallel to "A" in ascii table.
@venkat2304 жыл бұрын
Single quotations are responsible for printing ASCII value of A
@mobeenshaik42194 жыл бұрын
O/p will be 2 bcz sizeof doesn't evaluate expression
@karanneelkanth83183 жыл бұрын
Output will be ASCII VALUE OF A
@heyrishabh135 жыл бұрын
ASCII value of 'A' may be the answer.
@Rahulsingh-mq2ny5 жыл бұрын
65
@rajdeepray40094 жыл бұрын
1st: sizeof (var)? (var2>23 ? ((var==75)? 'A' : 0) : 0) : 0 ; is evaluated and here sizeof(var) is either 2 or 4 (depends on machine to machine), not zero. and go for next expression: (var2>23 ? ((var==75)? 'A' : 0) : 0) 2nd: (var2>23 ? ((var==75)? 'A' : 0) : 0) is evaluated and here var2>23 this also true and to for next expression: (var==75)? 'A' : 0) 3rd: (var==75) ? 'A' : 0 is evaluated and here var==75 is true, so 'A' go forward.Then 'A' is assigned with num and then print 'A' in integer form: 65 (ASCII)
@neelabauri95032 жыл бұрын
do we have to memorise the ascii table values?
@selvalakshmis.v42323 жыл бұрын
65. Thank you, Sir
@DarkyS734 жыл бұрын
thank you so much sir
@jagath123-m2r5 жыл бұрын
Both conditions are satisfied and print A value or A
@recursiveminds5 жыл бұрын
output is 65 because 65 is acii value of A
@vinaykumarreddy99563 жыл бұрын
using return in ternary operator is allowed?
@deekshdeekshitha67444 жыл бұрын
Output of assignment is 65
@manuvenu283 жыл бұрын
It's the ascii value of A
@ritikshrivastava94424 жыл бұрын
Sir, I am unable to understand that last problem but I know how to use if else or nested as well so I break down that problem into if else #include int main() { int a=75; int b=56; int num; if(sizeof(a)) { if(b>23) { if(a ==75) { num = 'A'; } } printf("%d",num); } return 0; } And I have questions as we need to learn the ASCI table ? For i.e if we go for an interview the question arrive in which ASCI table is used in output so in that situation what we do? So pls tell should we learn that or these type of questions is not being asked in interview