int x=2,y=5; | Sololearn: Learn to code for FREE!

+1

int x=2,y=5;

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

8/19/2019 1:10:37 PM

Khushi Puri

6 Answers

New Answer

+1

Every number is true (except 0)

+3

Bcz all non-zero numbers are considered as 1. Logic gates give ans in Boolean type only . i.e 1 , 0.

+2

Why 2 and 5 are true??

+2

Thanks for clearing my doubts

+2

All non-zero values considered as 'True-1', when they used with logical operators like - && :logical AND, ||: logical OR. HOPE THIS HELPS...!!

+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