Computer Science: A Structured Programming Approach Using C, Third Edition
Computer Science: A Structured Programming Approach Using C, Third Edition
3rd Edition
ISBN: 9780534491321
Author: Behrouz A. Forouzan, Richard F. Gilberg
Publisher: Course Technology, Inc.
bartleby

Videos

Textbook Question
Book Icon
Chapter 2, Problem 31PS

Code the variable declarations for each of the following:

a. a short integer variable named code

b. a constant named salesTax initialized to .0825

c. a floating-point named sum of size double initialized to 0

Blurred answer
Students have asked these similar questions
Give meaningful identifiers for the following variables and write a proper C++ declaration and initialization to a reasonable value. a. A variable to store the letter grade, (A, B, C, D, or F).b. A variable to store the sales tax price of an item.c. A variable to store the number of juice bottles sold.d. A variable to store the billing amount of a doctor’s visit.e. A variable to store the grade point average (GPA).
20. Give meaningful identifiers for the following variables and write a proper C11 declaration and initialization to a reasonable value. (1, 6, 7)a. A variable to store the letter grade, (A, B, C, D, or F).b. A variable to store the sales tax price of an item.c. A variable to store the number of juice bottles sold.d. A variable to store the billing amount of a doctor’s visit.e. A variable to store the grade point average (GPA).
Following is an example of different ways one can declare variables in some programming language.Write down the regular expression that can generate such variable declarations.Assume that-   All variable names are at most five (previously written as exactly five; both will be considered correct) characters long. Variable names can contain only small letters [a-z], digits [0-9], and two special characters $ (dollar) and _ (underscore).  $ sign can only be used at the beginning.  No names can start with digits. The variable types are integer, real, char, and Boolean only. The word ‘var’ which denotes variable is optional. Ignore any whitespace (space, tab, newline, etc.) Infer the rest of the rules from the code snippets below-var int1 : integer;var foo_1 : boolean;var f2 : real;_ind: char;x, y, z: integer;

Chapter 2 Solutions

Computer Science: A Structured Programming Approach Using C, Third Edition

Ch. 2 - To print data left justified, you would use a in...Ch. 2 - Prob. 12PSCh. 2 - One of the most common errors for new programmers...Ch. 2 - Which of the following is not a character constant...Ch. 2 - Which of the following is not an integer constant...Ch. 2 - Which of the following is not a floating-point...Ch. 2 - Prob. 17PSCh. 2 - Which of the following is not a valid identifier...Ch. 2 - What is the type of each of the following...Ch. 2 - What is the type of each of the following...Ch. 2 - Which of the following identifiers are valid and...Ch. 2 - Which of the following identifiers are valid and...Ch. 2 - What is output from the following program...Ch. 2 - Prob. 24PSCh. 2 - Find any errors in the following program....Ch. 2 - Find any errors in the following program....Ch. 2 - Prob. 27PSCh. 2 - Prob. 28PSCh. 2 - Prob. 29PSCh. 2 - Code the variable declarations for each of the...Ch. 2 - Code the variable declarations for each of the...Ch. 2 - Write a statement to print the following line....Ch. 2 - Write a program that uses four print statements to...Ch. 2 - Write a program that uses four print statements to...Ch. 2 - Write a program that uses defined constants for...Ch. 2 - Prob. 36PSCh. 2 - Prob. 37PSCh. 2 - Write a program that prompts the user to enter an...Ch. 2 - Write a C program using printf statements to print...Ch. 2 - Write a program that reads a character, an...Ch. 2 - Write a program that prompts the user to enter...Ch. 2 - Write a program that reads 10 integers and prints...Ch. 2 - Write a program that reads nine integers and...
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
  • Text book image
    Microsoft Visual C#
    Computer Science
    ISBN:9781337102100
    Author:Joyce, Farrell.
    Publisher:Cengage Learning,
Text book image
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
What Are Data Types?; Author: Jabrils;https://www.youtube.com/watch?v=A37-3lflh8I;License: Standard YouTube License, CC-BY
Data Types; Author: CS50;https://www.youtube.com/watch?v=Fc9htmvVZ9U;License: Standard Youtube License