+ 3
#include <iostream> using namespace std; int main() { int x = 15/(3*(5/3)); cout << x; return 0;} D output wz 5 hw
9 Respuestas
+ 8
parenthesis has highest priority to evaluate and parenthesis are solved most inner to outer so first
(5/3) will evaluate and give op 1 because 3 can divide 5 at 1 time so op is 1 and remainder is 2
then(3*(1)) which op as 3
then 15/3 which gives 5
so finally the output is 5
+ 2
Oh I get it
+ 1
The out put of this code was "5"
I still don't understand how
#include <iostream>
using namespace std;
int main()
{
int x = 15/(3*(5/3));
cout << x;
return 0;
}
+ 1
because all numbers are int, so
5/3 is 1
3*(5/3) is 3
15/3 is 5
+ 1
Whats the reasoning behind declaring 5/3 as 1
couldn't it then have also declared 15/3 as 1
was it the bracket
+ 1
But (5/3) ISN'T 1!!!
+ 1
as i said because all numbers are int
5/3 in calculator is 1.6 and when convert to int will be 1
15/ 3 in calculator is 5 and int of it is 5 too
+ 1
I get it
0
Lol