Write your question here.
Write a program that display running total of sales as many as enter by the user. It also displays text amount of 30% of total sale 30% off stock cost and then it display remaining amount of profit.
<>
#include <iostream>
using namespace std;
int main()
{
//s=sales, sc=off stock cost, ta=text amount , p=profit
int s, ta, sc, p=0;
cout << "\nEnter sales:";
cin >> s;
ta = s - 0.3;
cout << "\n Text amount is:" << ta;
sc = s - 0.3;
cout << "\n Stock Cost is:" << sc;
p = s - (ta - sc);
cout << "\n Profit is:" << p;
system("pause");
return 0;
Thank you for the reply
My problem is Unexpected output..
unexpected Output is
Enter sales:500
Text amount is:499
Stock Cost is:499
Profit is: 500 // how after deduction of Text amount and Stock cost profit is always same as sales..
above mention Output isn't according to my Question"Write a program that display running total of sales as many as enter by the user. It also displays text amount of 30% of total sale 30% off stock cost and then it display remaining amount of profit."
my English is bad hope you understand
And if int is integer; no fraction then what should be use instead of int?
Thanks
I know 30% of 500 is 150
but
how can we write the formula of ta and ca?
like ta=s-30%; // but it gives us error
now just want to know that how can we write the formula of ta or sc ?
hope you understand my problem ?
#include <iostream>
usingnamespace std;
double s;
double ta;
int main ()
{
cout << "please enter sale ammount" << endl;
cin >> s;
ta = (s * 0.3);
}
you'll want to add in a loop and a couple of if statements to check that the value entered into s is numeric, otherwise your program will crash if the value for s is a letter or word (this is the issue i was having).
Suppose you give a dinner party for six guests, but your table seats only four. In how many ways can four of the six guests arrange themselves at the table? Any of the six guests can sit in the first chair. Any of the remaining five can sit in the second chair. Any of the remaining four can sit in the third chair, and any of the remaining three can sit in the fourth chair. (The last two will have to stand.) So the number of possible arrangements of six guests in four chairs is 6*5*4*3, which is 360. Write a program that calculates the number of possible arrangements for any number of
guests and any number of chairs. (Assume there will never be fewer guests than chair)