Computer Science, asked by sujaychintakunta, 1 year ago

X is an integer (X=7531). The print value of Y of the flowchart below is
START
Read X
Y=0
Y=(Yx10)+(x%10)
X/10
x=o?
if NO
repeat the loop again
if Yes
Print Y
STOP​

Answers

Answered by qwtiger
7

Answer:

here we are make an iteration by using while loop with the condition that while the value of x is not zero the loop will continue.

int main()

{ int x= 7531, y=0;

while(x!=0)

{

y= (y x 10) + (x % 10);

  x= x /10;

}

printf(" %d" , y);

return 0;

}

Answered by lovingheart
1

According to the flowchart, the user is trying to read the value of x (assume x = 7531 as given in the question), then Y is assigned a value 0. There is a calculation process going on to recalculate the value for Y (Y=(Yx10)+(x%10) X/10 this needs to be cross checked, an operand is missing in the highlighted area) and then a condition is checked whether x is 0. According to the input, x is assigned a value 7531. So, the condition is false and loop repeats till x is 0 and finally print Y and stop the program.

Similar questions