0% found this document useful (0 votes)
34 views5 pages

Activity 4, BAA-BSME1

The document describes a C program and flowchart that prompts a customer to order 5 types of viands with prices. It calculates the total amount to be paid including a 12% VAT and allows the customer to input the amount paid. It then outputs the total due and calculates any change.

Uploaded by

Theodore Baa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views5 pages

Activity 4, BAA-BSME1

The document describes a C program and flowchart that prompts a customer to order 5 types of viands with prices. It calculates the total amount to be paid including a 12% VAT and allows the customer to input the amount paid. It then outputs the total due and calculates any change.

Uploaded by

Theodore Baa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Theodore C.

Baa BSME-1
Computer Engineering Department
Laboratory Activity Form

Course ES084

Course Title Computer Programming 1

Topics Covered: Sequential Programming

To implement basic I/O functions and arithmetic expressions. The use of


Objectives: integer division (/) operators and some built-in mathematical operations in
a program.

Description
Make a C program and draw the flowchart that prompts a customer to order 5 types of viand
with a corresponding price. Note: A 12% Value Added Tax will be charged to every customer.
The teller will also input the amount to be paid by the customer. Output the amount to be paid
by the customer as well as the change (if ever the amount given is more than the amount to be
paid.

Sample Output if Applicable

Remarks
START
Flowchart:

name of viand1: litson


name of viand2: sinigang
name of viand3: chopchuey
name of viand4: tinola
name of viand5: paksiw

price of viand1: 350


price of viand2: 150.75
price of viand3: 125.50
price of viand4: 75
price of viand5: 50.75

Total amount to be paid = (price of


viand1 + price of viand2 + price of
viand3 + price of viand4 + price of
viand5) *(12/100)

Total amount to be
paid: 842.24
amount to be paid:
1000

Change = Amount to be paid - Total


amount to be paid

Change: 157.76

END
C Program:

#include<stdio.h>

struct viand
{
char vnd [20];
float prc;
};

int main()
{
struct viand v[6];
int x;
float pay,chg,tot=0;
for(x=1;x<6;x++)
{
printf("Enter name of viand %d: ",x);
scanf("%s",v[x].vnd);
printf("Enter price of viand %d: ",x);
scanf("%f",&v[x].prc);
tot += v[x].prc;
printf("\n");
}
tot=tot+(tot*0.12);
printf("\nTotal Amount to be paid: %0.2f",tot);
printf("\n\nPlease enter amount to be paid: ");
scanf("%f",&pay);
chg=pay-tot;
printf("\nChange is: %0.2f", chg);

return 0;
}

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy