Study Program 8.2 carefully, then compile and execute it. [Kaji Program 8.2 dengan teliti, kemudian kompil dan laksana aturcara tersebut.] What does the program do? In what way is this program different from Program 8.1. [Apakah yang dilakukan oleh aturcara tersebut? Apakah perbezaan antara Program 8. 1. dan Program 8.2.] i. ii. Identify the body of the loop, and state how many times it is repeated. [Kenalpasti badan gelung, dan nyatakan berapa kalikah ia diulang.] Why do we now need only one variable to hold the prices of the item. [Mengapa kali ini kita hanya perlu satu pembolehubah untuk тепyimpan harga barangan.J III. iv. Change the statement for (Item=0; Item<7; Item++) in line 8 to the following; and state whether the output of the program remains the same, or if the output changes, what are the changes: (Tukar pernyatgan for (Item-0: Item<7: Item++) pada baris

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
Type the following program (Program 8.2):
[Taipkan aturcara yang berikut (Program 8.2 ):]
1.
//Program 8.2
#include <stdio.h>
1
#include <conio.h>
4
int main ()
{
do uble price, totalPrice=0 ;
int Item;
printf ("Program To Calculate The Average and Total
Price Of The 7 Items \n\n ") ;
for (Item=0; Item<7; Item++)
{
10
11
printf ("Enter price of item:
scanf("%lf", &price);
12
") ;
13
14
totalPrice += price;
15
printf("\n\nThe Average Price Of The Items
totalPrice/7);
16
Is
$f",
17
printf ("\nThe Total Price Of The Items
18
Is
$f", totalPrice);
19
20
printf("\n\nEnd Of Program");
getch () ;
return 0;
H H H N
21
Transcribed Image Text:Type the following program (Program 8.2): [Taipkan aturcara yang berikut (Program 8.2 ):] 1. //Program 8.2 #include <stdio.h> 1 #include <conio.h> 4 int main () { do uble price, totalPrice=0 ; int Item; printf ("Program To Calculate The Average and Total Price Of The 7 Items \n\n ") ; for (Item=0; Item<7; Item++) { 10 11 printf ("Enter price of item: scanf("%lf", &price); 12 ") ; 13 14 totalPrice += price; 15 printf("\n\nThe Average Price Of The Items totalPrice/7); 16 Is $f", 17 printf ("\nThe Total Price Of The Items 18 Is $f", totalPrice); 19 20 printf("\n\nEnd Of Program"); getch () ; return 0; H H H N 21
2.
Study Program 8.2 carefully, then compile and execute it.
[Kaji Program 8.2 dengan teliti, kemudian kompil dan laksana aturcara
tersebut.]
i.
What does the program do? In what way is this program different from
Program 8.1.
[Apakah yang dilakukan oleh aturcara tersebut? Apakah perbezaan
antara Program 8. 1. dan Program 8.2.]
ii.
Identify the body of the loop, and state how many times it is repeated.
[Kenalpasti badan gelung, dan nyatakan berapa kalikah ia diulang.]
Why do we now need only one variable to hold the prices of the item.
[Mengapa kali ini kita hanya perlu satu pembolehubah untuk
menyimpan harga barangan.]
IlI.
Change the statement for (Item=0; Item<7; Item+ +) in line 8
to the following; and state whether the output of the program remains
the same, or if the output changes, what are the changes:
[Tukar pernyataan for (Item=0; Item<7; Item++) pada baris
8 kepada pernyataan berikut; dan nyatakan sama ada hasil aturcara
tetap sama atau berubah. Jika berubah, nyatakan apakah perubahan
tersebut:]
iv.
a.
for (Item=0; Item <=7: Item ++)
b.
for (Item =0; Item <35: Item +=5)
for (Item =10; Item I<17: Item ++)
c.
d.
for (Item =7; Item >0; Item --)
Transcribed Image Text:2. Study Program 8.2 carefully, then compile and execute it. [Kaji Program 8.2 dengan teliti, kemudian kompil dan laksana aturcara tersebut.] i. What does the program do? In what way is this program different from Program 8.1. [Apakah yang dilakukan oleh aturcara tersebut? Apakah perbezaan antara Program 8. 1. dan Program 8.2.] ii. Identify the body of the loop, and state how many times it is repeated. [Kenalpasti badan gelung, dan nyatakan berapa kalikah ia diulang.] Why do we now need only one variable to hold the prices of the item. [Mengapa kali ini kita hanya perlu satu pembolehubah untuk menyimpan harga barangan.] IlI. Change the statement for (Item=0; Item<7; Item+ +) in line 8 to the following; and state whether the output of the program remains the same, or if the output changes, what are the changes: [Tukar pernyataan for (Item=0; Item<7; Item++) pada baris 8 kepada pernyataan berikut; dan nyatakan sama ada hasil aturcara tetap sama atau berubah. Jika berubah, nyatakan apakah perubahan tersebut:] iv. a. for (Item=0; Item <=7: Item ++) b. for (Item =0; Item <35: Item +=5) for (Item =10; Item I<17: Item ++) c. d. for (Item =7; Item >0; Item --)
Expert Solution
steps

Step by step

Solved in 4 steps with 1 images

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
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