Chapter 2 – #2: Sales Prediction – Tony Gaddis – Starting Out With C++

Chapter 2 – #2: Sales Prediction – Tony Gaddis – Starting Out With C++

Problem: 

The East Coast sales division of a company generates 62 percent of total sales. Based
on that percentage, write a program that will predict how much the East Coast division
will generate if the company has $4.6 million in sales this year.


Sales Prediction





Solution:-


#include <iostream>
using namespace std;
int main()
{
const double sale = 4600000;                             //Declare Constant & Initilize Value 4.6 Million
double percentage = 62 / 100.0;                        //Calculate Percentage

double genrate_sale = 0.0;
genrate_sale = sale * percentage;                      //Required Calculation


        //Output & Divide by 1M To Get Value In Million
cout << "Total Sale $" << genrate_sale / 1000000.0 << " million";                                                             
                       
return 0;                                              //Return 0 To the main Function


This Question Taken From  Tony Gaddis – Starting Out With C++

This is The Solution of This Question
Also, Attach the CPP file You can download easily.

Post a Comment

0 Comments