Problem Question Based On C Programming With Explanation
\\ If you have any query or questions on my post, then please comment below //
A departmental store places an order with a company for M pieces of electric mixture, N pieces of bread toaster & P pieces of electric fan the cost of items are as follows:
Mixer = A Rs/Piece
Toaster = B Rs/Piece
Fan = C Rs/Piece
The discount allowed for various items are:
10% for mixture
15% for fan
12.5 % for toaster
So Write a program to find the total cost paid by the customer.
Solution: For finding total cost first we have to find total amount, and second we have to find discount amount on that piece, and third we have to find the total amount by subtracting the total amount with discount amount. And finally we have to add all the products for finding total cost paid by the customer.
----------------------------------------------------------------------------------------------
#include<stdio.h>
#include<conio.h>
void main()
{
int M,N,P;
float A,B,C,COM,COB,COE,DM,DB,DE,AM,AB,AE,Total_Amt;
clrscr();
printf("Enter Piece Of Mixture, Toaster, Fan");
scanf("%d%d%d",&M,&N,&P);
printf("Enter The Price Of Mixture, Toaster, Fan");
scanf("%f%f%f",&A,&B,&C);
// Now We Have To Find Total Amount Of Each Product
COM = M*A; // Cost Of Mixer
COB = M*B; // Cost Of Toaster
COE = M*C; // Cost Of Fan
// Now Find Discount On Particular Product
DM = (0.1*COM); // Discount On Mixture
DB = (1.25*COB); // Discount On Toaster
DE = (1.5*COE); // Discount On Fan
// Find Actual Amount After Discount (Actual Amount = Cost Of Product - Discount On That Product)
AM = COM - DM; //Actual Amount Of Mixture
AB = COB - DB; //Actual Amount Of Toaster
AE = COE - DE; //Actual Amount Of Fan
// Find Total Cost Paid By The Customer
Total_Amt = AM+AB+AE;
printf("%f",Total_Amt);
getch();
}
----------------------------------------------------------------------------------------------------------------
So if you run this program in turbo c then definitely get the output, and if you have any query then please comment below. Or ask questions with us in the comment box.
Click Here To Know How To Download Above Video Tutorials Or YouTube Videos Free