0

What is the output ?

int a=2,b=4; printf("%d",a&&b);

27th Nov 2022, 1:32 PM
BADAVATH RAMKUMAR
6 Respuestas
+ 3
Depends on the programming language, it could be a syntax error. Have you actually tried to run it yourself?
27th Nov 2022, 1:40 PM
Tibor Santa
Tibor Santa - avatar
+ 3
...and you still have not answered to either of my follow-up questions: 1. Which programming language? 2. Have you tried running it, and what did you experience?
27th Nov 2022, 1:51 PM
Tibor Santa
Tibor Santa - avatar
+ 3
In C language, your code is failing with error, because there is no print function. If you use printf, the result is 1. && is the logical "and" operator. Both a and b are positive numbers which have a truthy value, therefore "a and b" is also true. The %d format specifier converts "true" to numeric value which is 1. The numeric value of false would be 0.
27th Nov 2022, 1:58 PM
Tibor Santa
Tibor Santa - avatar
+ 3
If you want to know WHAT the output is, do the following: Go to Code section, click +, select the programming language, insert your code, click Run. If you want to know HOW OR WHY the output is, please make that clear in your question.
27th Nov 2022, 2:41 PM
Lisa
Lisa - avatar
0
its not an error just try to answer how the code runs
27th Nov 2022, 1:41 PM
BADAVATH RAMKUMAR
0
c language
27th Nov 2022, 1:52 PM
BADAVATH RAMKUMAR