Answer to Question #273399 in C++ for juh

Question #273399

In the month of RAMZAN people distribute food packages. Carrefour offers a food package which contains


the following items 10kg flour, 5kg rice, 5ltr oil, 2pack salt and 500gm spices. Price of above items are:


1. Flour per kg 95


2. Rice per kg 210


3. Oil per liter 410


4. Salt per pack 50


5. Spices per 10 grams 5


Write a C++ program in which, take number of required bag from user and calculate the total price of


required packages and display it on console.

1
Expert's answer
2021-11-30T00:36:59-0500
#include<iostream>
#include<string>
#include <fstream>


using ​namespace std;

int main()
{
	float totalPrice;
	float flourPrice=95*10;
	float ricePrice=210*5;
	float oilPrice= 410*5;
	float saltPrice=50*2;
	float spicesPrice=(500/10)*5;
	int numberRequiredBag;
	cout<<"Enter a number of required bag: ";
	cin>>numberRequiredBag;
	totalPrice=numberRequiredBag*(flourPrice+ricePrice+oilPrice+saltPrice+spicesPrice);
	cout<<"The total price of required packages: "<<totalPrice<<"\n";
	cin>>totalPrice;
	return 0;

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS