HELP!!!

how to count number of operation for below equation-
total=(X*(x-2))/3

if x=8
total= 16
there are 3 mathmatical operation happening(*, /, -) but i don't know how to break it in c++
================================================
1
2
3
4
5
void result (int inputB){
	int  total = 0; int  i=inputB;
	total = (i * (i - 2)) / 3;

	cout << "The total of all numbers between 0 and " << i << " is: " << total << "\n";

I think the code you have will work when inputB=8. But note that when inputB=10, the formula is 10*8/3 which is not an integer.
ya, actually the formula is something else, i was just practicing to this so I know what to do on the original formula.

Topic archived. No new replies allowed.