Consider the following assignment statement in a C program, where x and y are integer variables, and x
has been initialized to a valid integer value:
y = x + 1;
Is it always true that after the execution of this line of code, y is 1 larger than x? Try to prove or disprove this statement.

Respuesta :

Answer:

int main(){

int x = -5;

int y = x+1;

printf("%d",y)

return 0;

}

// Out : -4

Explanation:

In this test you can disprove the statement as the integer numbers can take negative values e.g.(Ζ=(....-5,-4,...0....4,5...)) . If the X value is less or equal than 1 the statement of "Y is 1 larger than X" is going to be false.

I hope it's help you.

ACCESS MORE