0

int x=2,y=5;

printf("%d",x&&y); what will be the output explain

19th Aug 2019, 1:10 PM
Khushi Puri
Khushi Puri - avatar
6 Answers
+ 1
Every number is true (except 0)
19th Aug 2019, 1:22 PM
Airree
Airree - avatar
+ 3
Bcz all non-zero numbers are considered as 1. Logic gates give ans in Boolean type only . i.e 1 , 0.
31st Aug 2019, 7:17 AM
Sahil
Sahil - avatar
+ 2
Why 2 and 5 are true??
19th Aug 2019, 1:21 PM
Khushi Puri
Khushi Puri - avatar
+ 2
Thanks for clearing my doubts
19th Aug 2019, 1:23 PM
Khushi Puri
Khushi Puri - avatar
+ 2
All non-zero values considered as 'True-1', when they used with logical operators like - && :logical AND, ||: logical OR. HOPE THIS HELPS...!!
19th Aug 2019, 1:41 PM
Kuri
Kuri - avatar
+ 1
x && y: Checks if both values are true. 2 is true, 5 is true, therefore x && y is true. There aren't really booleans in C, so the output will be the number 1
19th Aug 2019, 1:19 PM
Airree
Airree - avatar