Solution for Exercise 6-5
ex0605
#include <stdio.h> int main() { int blorf; blorf = 22; printf("The value of blorf is %d.\n",blorf); printf("The value of blorf plus 16 is %d.\n",blorf+16); printf("The value of blorf times itself is %d.\n",blorf*blorf); return(0); }
Notes
* In Lines 10 and 11 demonstrate how you can calculate immediate values and display the results by using the printf() function.
* Even though a variable is used in a calculation, the expression's result is considered immediate because it's not stored anywhere. That's because:
* In C, you can use any variable to represent a value in an equation. In fact, most of your code will use variables in equations instead of immediate values.
* Manipulating the blorf
variable in Lines 10 and 11 doesn't change its value. To prove it, add a fourth printf() statement that duplicates Line 9. The output proves that the value of blorf
is not altered by its immediate manipulation in the printf() function.
Copyright © 1997-2024 by QPBC.
All rights reserved