CBSE BOARD XII, asked by Rajan2888, 9 months ago

What will be the value of x after execution of the following c program segment int X,Y,Z. Y=20,Z=15 X=(Y/3)×10

Answers

Answered by qwsuccess
0

The value of X after execution of the following C program segment is equal to 60.

  • X,Y,Z are declared as integer data types.
  • An integer data type can store only numbers(positive,negative and zero) into it.
  • The expression first divides Y by 3 and then multiplies the output by 10 and stores the result in X.
  • On dividing Y by 3 we, get 6.66666 but an integer divided by an integer can only return an integer so the output we get after truncation is 6.
  • Multiplying 6 with 10 , we finally get 60 which is stored in the variable X.
Similar questions