You are on page 1of 3

C-PROGRAMMING LANGUAGE

Machine Problem No. 2

Name

INSTRUCTIONS:  Create a program flowchart with corresponding C-Language program with


computation using a float data type.

Flowchart:
Start

float a,b,c,d,e,f,g,h,price,vat,totprice,payment,change

Input “Enter the price of the first item:” a


Input “Enter the price of the second item:” b
Input “Enter the price of the third item:” c
Input “Enter the price of the forth item:” d
Input “Enter the price of the fifth item:” e
Input “Enter the price of the sixth item:” f
Input “Enter the price of the seventh item:” g
Input “Enter the price of the eighth item:” h

price=a+b+c+d+e+f+g+h
vat=price*0.15
totprice=price+vat

Print “item price:” price


Print “15 percent Vat is:” vat
Print “Total price is :” totprice
Input “Enter your payment for all items that you buy”

Change=payment-amount

Print “Change Due” change

End

Program Source Code:


#include<stdio.h>
#include<conio.h>
main(){
float a,b,c,d,e,f,g,h,price,vat,totprice,payment,change;
clrscr();
gotoxy(20,5);
cprintf("*****PURE SILVER GROCERRY*****");
gotoxy(19,6);
cprintf("BLDG. 640 DUHAT ST., NAKATAGO BAY");
printf("\n\nSAMYANG:");
scanf("%f",&a);
printf("CHARMEE WW:");
scanf("%f",&b);
printf("HOT AND SPICY PANCIT CANTON:");
scanf("%f",&c);
printf("CHILIMANSI PANCIT CANTON:");
scanf("%f",&d);
printf("REGULAR PANCIT CANTON:");
scanf("%f",&e);
printf("DOVE SHAMPOO:");
scanf("%f",&f);
printf("PIC-A CHDR FLAVOR:");
scanf("%f",&g);
printf("WAFFER CHOCO BRIX:");
scanf("%f",&h);
price=a+b+c+d+e+f+g+h;
vat=price*0.15;
totprice=price+vat;
printf("\nItem price: %f ",price);
printf("\nThe 15 percent Vat is: %f",vat);
printf("\nTotal price is: %f ",totprice);
printf("\n\nEnter payment:");
scanf("%f",&payment);
change=payment-totprice;
printf("\n Your Change Due is: %f", change);
gotoxy(20,22);
cprintf("\n\nTHANK YOU FOR SHOPPING WITH US!!");
getch();}

You might also like