Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
Bartleby Related Questions Icon

Related questions

Question
The snippet below displays line numbers off to the left to identify each line of the code. Use these numbers to identify the line numbers that make up each of the
four parts of every loop.
int item;
double itemCost;
1:
2:
double totalCost =0;
for (item = 1; item <= 10; item++)
{
printf("Please enter item cost: ");
scanf("n%lf", &itemCost);
totalCost += itemCost;
3:
4:
5:
6:
7:
8:
9:
10:
printf("nThe total cost is %.21f", totalCost);
A. Line 1:
B. Line 2:
C. Line 3:
initialization of the test variable
D. Line 4:
conditional test
E. Lines 5: -9:
body of the loop
F. Lines 5: - 10:
affect the test
G. Line 7:
H. Line 8:
I. Line 10:
expand button
Transcribed Image Text:The snippet below displays line numbers off to the left to identify each line of the code. Use these numbers to identify the line numbers that make up each of the four parts of every loop. int item; double itemCost; 1: 2: double totalCost =0; for (item = 1; item <= 10; item++) { printf("Please enter item cost: "); scanf("n%lf", &itemCost); totalCost += itemCost; 3: 4: 5: 6: 7: 8: 9: 10: printf("nThe total cost is %.21f", totalCost); A. Line 1: B. Line 2: C. Line 3: initialization of the test variable D. Line 4: conditional test E. Lines 5: -9: body of the loop F. Lines 5: - 10: affect the test G. Line 7: H. Line 8: I. Line 10:
Expert Solution
Check Mark
Step 1

The given code is

1 : int item;

2 : double itemCost;

3: double totalCost;

4 : for(item = 1; item <= 10; item++)

5 : {

6 :        printf("Please enter item cost:");

7 :        scanf("n%1f", &itemCost);

8 :        totalCost += itemCost;

9 : }

10 : printf("\nThe total cost is %.21f", totalCost);

 

bartleby

Step by stepSolved in 2 steps

Blurred answer
Knowledge Booster
Background pattern image
Similar questions
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education