# Answer to Question #53472 in C for rajashree g.s.

Question #53472

#include<stdio.h>

int main()

{

int x=15;

printf("\n %d %d %d",x!=15,x=20,x<30);

return 0;

}

please explain the logic behind this program and give the output sir.

int main()

{

int x=15;

printf("\n %d %d %d",x!=15,x=20,x<30);

return 0;

}

please explain the logic behind this program and give the output sir.

Expert's answer

Solve

Output:

1 20 1

Explain:

In printf exist assignment to x, it execute first. So, at printf value of x is 20.

Since 20≠15, we have true value and as integer this expression have value 1

Since x=20, second output – is output x, so, we have 20

Since 20<30, we have true value and as integer this expression have value 1

Since string line start from \n, this line prints from new line

Output:

1 20 1

Explain:

In printf exist assignment to x, it execute first. So, at printf value of x is 20.

Since 20≠15, we have true value and as integer this expression have value 1

Since x=20, second output – is output x, so, we have 20

Since 20<30, we have true value and as integer this expression have value 1

Since string line start from \n, this line prints from new line

Need a fast expert's response?

Submit orderand get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

## Comments

## Leave a comment