0% found this document useful (0 votes)
22 views2 pages

Fundamentals of Programming Activity 1

This document is a C program that calculates the total cost of items purchased at a local bookstore, including VAT and change from cash given. It prompts the user for quantities of various items (paper, pencil, scissors, eraser), computes the total cost, and displays an official receipt with detailed pricing information. The program also calculates the price before VAT and the VAT amount.

Uploaded by

44kg89tv4w
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)
22 views2 pages

Fundamentals of Programming Activity 1

This document is a C program that calculates the total cost of items purchased at a local bookstore, including VAT and change from cash given. It prompts the user for quantities of various items (paper, pencil, scissors, eraser), computes the total cost, and displays an official receipt with detailed pricing information. The program also calculates the price before VAT and the VAT amount.

Uploaded by

44kg89tv4w
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/ 2

1: /* ESTHER E.

QUITE
2: PBDIT
3: FUNDAMENTALS OF PROGRAMMING ACTIVITY #1
4: */
5:
6: #include<stdio.h> /* printf, scanf definitions*/
7: #include<conio.h>
8:
9: int Paper, Pencil, Scissors, Eraser, Items;
10: float PAPER, PENCIL, SCISSORS, ERASER, Total, Cash, Change, Price, VAT;
11:
12: int main()
13: {
14: /* INPUT */
15: printf("Paper : ");
16: scanf("%d",&Paper);
17: PAPER = Paper*1.00;
18: printf("Pencil : ");
19: scanf("%d",&Pencil);
20: PENCIL = Pencil*5.00;
21: printf("Scissors : ");
22: scanf("%d",&Scissors);
23: SCISSORS = Scissors*25.00;
24: printf("Eraser : ");
25: scanf("%d",&Eraser);
26: ERASER = Eraser*2.50;
27: Items = Paper + Pencil + Scissors + Eraser;
28: Total = PAPER + PENCIL + SCISSORS + ERASER;
29: printf("Cash : P");
30: scanf("%f",&Cash);
31: Change = Cash - Total;
32: Price = Total / 1.12;
33: VAT = Price * .12;
34: /* OUTPUT */
35: printf("\n");
36: printf("\n");
37: printf("\n L O C A L - B O O K S T O R E");
38: printf("\n OFFICIAL RECEIPT");
39: printf("\n---------------------------------------");
40: printf("\n");
41: printf("\n");
42: printf("\n%d",Paper);printf(" Paper @ 1.00 ");printf("P %.2f",PAPER);
43: printf("\n%d",Pencil);printf(" Pencil @ 1.00 ");printf("P %.2f",PENCIL);
44: printf("\n%d",Scissors);printf(" Scissors@ 1.00 ");printf("P %.2f",SCISSORS);
45: printf("\n%d",Eraser);printf(" Eraser @ 1.00 ");printf("P %.2f",ERASER);
46: printf("\n");
47: printf("\n");
48: printf("\n---------------------------------------");
49: printf("\nTOTAL AMOUNT DUE : P");printf("%.2f",Total);
50: printf("\nCASH : P");printf("%.2f",Cash);
51: printf("\nCHANGE : P");printf("%.2f",Change);
52: printf("\n");
53: printf("\nNo of Items :");printf("%d",Items);
54: printf("\n");
55: printf("\nPrice before VAT : P");printf("%.2f",Price);
56: printf("\nVAT : P");printf("%.2f",VAT);
57:
58:
59: getch();
60: return 0;
61: }

You might also like