MHB ZyBooks: 2.4.1: Enter the output of the integer expressions.

AI Thread Summary
The discussion focuses on understanding a programming problem involving variable assignments and print statements. Initially, variables x and y are set to 3 and 0, respectively. The command "y = (2 * (x + 3)) + 6" calculates the new value of y based on the current value of x. After executing this command, y will be updated accordingly. The conversation then explores the output of various print statements: "system.out.print(x)" displays the value of x, while "system.out.print(y)" shows the updated value of y. The combined print statement "System.out.print(x + " " + y)" outputs both values of x and y in a formatted string. The discussion emphasizes understanding variable manipulation and output in programming.
zbandicoot1491
Messages
1
Reaction score
0
I'm not sure how to do these problems here. Help me learn them please!
View attachment 7289
 

Attachments

  • Capture.PNG
    Capture.PNG
    13.6 KB · Views: 116
Technology news on Phys.org
Okay, let's go through it step by step. Initially, x is set to 3 and y is set to 0. Now, do you understand what the command "y= (2*(x+ 3))+ 6" means? What will x and y be after that is executed?

Then what would "system.out.print(x)" do? What about "system.out.print(y)". So what about "System.out.print(x+ " "+ y)?
 
Dear Peeps I have posted a few questions about programing on this sectio of the PF forum. I want to ask you veterans how you folks learn program in assembly and about computer architecture for the x86 family. In addition to finish learning C, I am also reading the book From bits to Gates to C and Beyond. In the book, it uses the mini LC3 assembly language. I also have books on assembly programming and computer architecture. The few famous ones i have are Computer Organization and...
I have a quick questions. I am going through a book on C programming on my own. Afterwards, I plan to go through something call data structures and algorithms on my own also in C. I also need to learn C++, Matlab and for personal interest Haskell. For the two topic of data structures and algorithms, I understand there are standard ones across all programming languages. After learning it through C, what would be the biggest issue when trying to implement the same data...
Back
Top