Simple Problem
Simple Problem
Where:
Solution:
#include<iostream.h> int q1,q2,p1,p2,ed; int main() { cout<<"First Quantity:"; cin>>q1; cout<<"Second Quantity:"; cin>>q2; cout<<"First Price:"; cin>>p1; cout<<"Second Price:"; cin>>p2; ed= ((q1-q2)/q1)/((p1-p2)/p1); cout<<"The elasticity of demand is:"<<ed<<endl; system ("PAUSE"); } return 0;
2. Write a C++ program that will compute for the total cost, total revenue and profit. Where: Total Cost = Variable Cost + Fixed Cost Total Revenue = Quantity x Price Profit = Total Revenue Total Cost Solution: #include<iostream.h> int VC,FC,Q,pr,TR,TC,P; int main() { cout<<"Input cin>>VC; cout<<"Input cin>>FC; cout<<"Input cin>>Q; cout<<"Input cin>>pr; TC= VC+FC; TR=Q*pr; P=TR-TC; cout<<"The Total Cost is:"<<TC<<endl; cout<<"The Total Revenue is:"<<TR<<endl; cout<<"The Profit is:"<<P<<endl; system ("PAUSE"); } return 0;
3. Write a C++ program that will compute for the diameter and circumference of a circle. Where: Diameter = 2 x radius Circumference = diameter x pi Solution: #include<iostream.h> int r,d; float c; const float pi=3.14; int main() { cout<<"Input the radius:"; cin>>r; d=2*r; c=d*pi; cout<<"The diameter is:"<<d<<endl; cout<<"The dcircumference is:"<<c<<endl; system ("PAUSE"); } return 0;
4. Write a C++ program that will compute for the slope a line. Where: Slope = Solution: #include<iostream.h> int y1,y2,x1,x2,y,x; float m; int main() { cout<<"Input cin>>y1; cout<<"Input cin>y2; cout<<"Input cin>>x1; cout<<"Input cin>>x2; y=y1-y2; x=x1-x2; m=y/x; cout<<"The Slope is:"<<m<<endl; system ("PAUSE"); } return 0;
5. Write a C++ program that will compute for the amount due of customers and total change by giving the number of scan, print, layout and amount received. Where: 1 Scan = 15 1 print = 3 1 layout = 75 Solution: int main() { cout<<"Number of Scan:"; cin>>s; cout<<"Number of Print:"; cin>>p; cout<<"Number of Layout:"; cin>>l; cout<<"Amount received:"; cin>>ar; ts=s*15; tp=p*3; tl=l*75; ad=ts+tp+tl; tc=ar-ad; cout<<"The amount due is:"<<ad<<endl; cout<<"The total change is:"<<tc<<endl; system ("PAUSE"); } return 0;