May 23, 2012 at 1:57pm UTC
im starting to learn c++ and i have to make a program with a little math , but also have to give the answer to the math problem written and i'm not sure if it goes like this:
x=(3*9*(3+(9*3/(3))));
x=(3*9*(3+(27/3)))
x=(3*9*(3+9))
x=(3*9*(12))
x=(3*108)
x=(324)
or
x=(3*9*(3+(9*3/(3))));
x=(3*9*(3+(27/3)))
x=(3*9*(3+9))
x=(3*9*(12))
x= 3*108
x= 324
the program would be
#include <iostream>
using namespace std;
int main()
{
int x= (3*9*(3+(9*3/(3))));
cout << x;
cin.get();
return 0;
}
any help would be appreciated
thanks
Last edited on May 23, 2012 at 1:57pm UTC
May 23, 2012 at 2:07pm UTC
Both your calculations do the same thing and gives the correct answer.
May 23, 2012 at 2:13pm UTC
but i was not sure if it was right or wrong to remove the parentheses from the last numbers
thanks