Course Hero Logo

H whenever a new value is placed in a memory location

Course Hero uses AI to attempt to automatically extract content from documents to surface to you and others so you can study better, e.g., in search results, to enrich docs, and more. This preview shows page 24 - 26 out of 31 pages.

h)Whenever a new value is placed in a memory location, that value overrides the previousvalue in that location. This process is said to bei)When a value is read out of a memory location, the value in that location is preserved;this process is said to bej)Thestatement is used to make decisions.2.2State whether each of the following istrueorfalse. Iffalse, explain why.a)Functionprintfalways begins printing at the beginning of a new line.b)Comments cause the computer to print the text enclosed between/*and*/on thescreen when the program is executed.c)The escape sequence\nwhen used in aprintfformat control string causes the cursorto position to the beginning of the next line on the screen.d)All variables must be defined before they’re used.e)All variables must be given a type when they’re defined.f)C considers the variablesnumberandNuMbErto be identical.g)Definitions can appear anywhere in the body of a function.h)All arguments following the format control string in aprintffunction must be preced-ed by an ampersand (&).i)The remainder operator (%) can be used only with integer operands.j)The arithmetic operators*,/,%,+and-all have the same level of precedence.k)The following variable names are identical on all Standard C systems.thisisasuperduperlongname1234567thisisasuperduperlongname1234568l)A program that prints three lines of output must contain threeprintfstatements.2.3Write a single C statement to accomplish each of the following:a)Define the variablesc,thisVariable,q76354andnumberto be of typeb)Prompt the user to enter an integer. End your prompting message with a colon (:) fol-lowed by a space and leave the cursor positioned after the space.c)Read an integer from the keyboard and store the value entered in integer variablead) Ifnumberis not equal to7, print"Thevariablenumberisnotequalto7..int..."
Answers to Self-Review Exercises47e)Print the message"ThisisaCprogram."on one line.f)Print the message"ThisisaCprogram."on two lines so that the first line ends withCg)Print the message"ThisisaCprogram."with each word on a separate line.h)Print the message"ThisisaCprogram."with the words separated by tabs.2.4Write a statement (or comment) to accomplish each of the following:a)State that a program will calculate the product of three integers.b)Define the variablesx,y,zandresultto be of typec)Prompt the user to enter three integers.d)Read three integers from the keyboard and store them in the variablesx,yande)Compute the product of the three integers contained in variablesx,yandz, and assignthe result to the variableresultf)Print"Theproductis"followed by the value of the integer variableresult2.5Using the statements you wrote in Exercise 2.4, write a complete program that calculatesthe product of three integers..int.z...

Upload your study docs or become a

Course Hero member to access this document

Upload your study docs or become a

Course Hero member to access this document

End of preview. Want to read all 31 pages?

Upload your study docs or become a

Course Hero member to access this document

Term
Spring
Professor
PaulJ.Deitel
Tags
C Programming, common programming error

Newly uploaded documents

Show More

Newly uploaded documents

Show More

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture