Study Program 8.1 carefully, then compile and execute it. [Kaji Program 8.1 dengan teliti, kemudian kompil dan laksana aturcara tersebut.] i. What does the program do? [4pakah yang dilakukan oleh aturcara tersebut?] ii. Why do you need 7 variables to hold the prices of the items? [Mengapa 7 pembolehubah diperlukan untuk menyimpan harga barangan?] Why is the variable totalPrice initialized to 0? [Mengapa pembolehubah totalPrice diberi nilai awal 0?] III. iv. Identify the set of statements that are repeated many times in the program. [Kenalpasti set pernyataan yang diulang beberapa kali dalam aturcara ini.] How many times were the set of statements repeated? [Berapa kalikah set pernyataan tersebut diulang?] V.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
2.
Study Program 8.1 carefully, then compile and execute it.
[Kaji Program 8.1 dengan teliti, kemudian kompil dan laksana aturcara
tersebut.]
What does the program do?
[Apakah yang dilakukan oleh aturcara tersebut?]
i.
ii.
Why do you need 7 variables to hold the prices of the items?
[Mengapa 7 pembolehubah diperlukan untuk menyimpan harga
barangan?]
Why is the variable totalPrice initialized to 0?
[Mengapa pembolehubah totalPrice diberi nilai awal 0?]
Il1.
iv.
Identify the set of statements that are repeated many times in the
program.
[Kenalpasti set pernyataan yang diulang beberapa kali dalam aturcara
ini.]
How many times were the set of statements repeated?
[Berapa kalikah set pernyataan tersebut diulang?]
V.
Transcribed Image Text:2. Study Program 8.1 carefully, then compile and execute it. [Kaji Program 8.1 dengan teliti, kemudian kompil dan laksana aturcara tersebut.] What does the program do? [Apakah yang dilakukan oleh aturcara tersebut?] i. ii. Why do you need 7 variables to hold the prices of the items? [Mengapa 7 pembolehubah diperlukan untuk menyimpan harga barangan?] Why is the variable totalPrice initialized to 0? [Mengapa pembolehubah totalPrice diberi nilai awal 0?] Il1. iv. Identify the set of statements that are repeated many times in the program. [Kenalpasti set pernyataan yang diulang beberapa kali dalam aturcara ini.] How many times were the set of statements repeated? [Berapa kalikah set pernyataan tersebut diulang?] V.
EXERCISE 1:
[LATIHAN I]
Type in the following program (Program 8.1):
[Taip aturcara yang berikut (Program 8.1 ):].
1.
//Program 8.1
#include <stdio.h>
#include <conio.h>
int main()
double pricel,
price6, price7, totalPrice-0;
printf("Program To Calculate The Average and Total
price2,
price3,
price4,
price5,
7
Price of The 7 Items \n \n ");
printf("Enter price of item:
scanf ("$lf", spricel);
totalPrice +- pricel;
printf("Enter price of item:
") ;
10
11
") ;
scanf ("$lf", sprice2);
totalPrice +- price2;
printf("Enter price of item:
scanf ("$lf", sprice3);
totalPrice += price3;
printf("Enter price of item:
13
") ;
15
16
17
") :
scanf ("$lf", sprice4);
totalPrice +- price4;
printf("Enter price of item:
18
19
20
") :
scanf ("$lf", sprice5);
totalPrice +- price5;
printf("Enter price of item:
scanf ("$lf", sprice6);
totalPrice +- price6;
printf("Enter price of item:
scanf ("$lf", sprice7);
totalPrice +- price7;
21
23
") :
24
25
26
") :
27
28
29
printf("\n\nThe Average Price of The Items Is
total Price/7);
printf("\nThe Total Price of The Items Is
totalPrice);
printf("\n\nEnd Of Program");
getch();
return 0;
30
$f",
31
32
SE",
33
34
35
36
37
38
O-2 34
2345n
o a - - --- ---- 122 2222N 222 233 333 3m3
1234 n6
Transcribed Image Text:EXERCISE 1: [LATIHAN I] Type in the following program (Program 8.1): [Taip aturcara yang berikut (Program 8.1 ):]. 1. //Program 8.1 #include <stdio.h> #include <conio.h> int main() double pricel, price6, price7, totalPrice-0; printf("Program To Calculate The Average and Total price2, price3, price4, price5, 7 Price of The 7 Items \n \n "); printf("Enter price of item: scanf ("$lf", spricel); totalPrice +- pricel; printf("Enter price of item: ") ; 10 11 ") ; scanf ("$lf", sprice2); totalPrice +- price2; printf("Enter price of item: scanf ("$lf", sprice3); totalPrice += price3; printf("Enter price of item: 13 ") ; 15 16 17 ") : scanf ("$lf", sprice4); totalPrice +- price4; printf("Enter price of item: 18 19 20 ") : scanf ("$lf", sprice5); totalPrice +- price5; printf("Enter price of item: scanf ("$lf", sprice6); totalPrice +- price6; printf("Enter price of item: scanf ("$lf", sprice7); totalPrice +- price7; 21 23 ") : 24 25 26 ") : 27 28 29 printf("\n\nThe Average Price of The Items Is total Price/7); printf("\nThe Total Price of The Items Is totalPrice); printf("\n\nEnd Of Program"); getch(); return 0; 30 $f", 31 32 SE", 33 34 35 36 37 38 O-2 34 2345n o a - - --- ---- 122 2222N 222 233 333 3m3 1234 n6
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
ADT and Class
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
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education