I am new, need help please. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

I am new, need help please.

Can someone explain to me why the output is 81? #include <iostream> using namespace std; int main() { int x = 21, y = 31, z; z = (x % 5) * 9 / (y % 6) * 9; cout << z; return 0; }

5th Aug 2018, 1:07 PM
Marven Mendoza
Marven Mendoza - avatar
3 Answers
+ 2
(21%5) * 9 / (31%6) *9 (1)*9 / (1)*9 9/1*9 9*9 81
5th Aug 2018, 1:11 PM
Comsis Alexis
Comsis Alexis - avatar
0
Next time specify the language in the tags
5th Aug 2018, 1:11 PM
Comsis Alexis
Comsis Alexis - avatar
0
https://www.sololearn.com/learn/CPlusPlus/1609/ Go to last part and open the comment section , there I had written detailed comment how operator precedence works. Hope this helps ☺️☺️.
5th Aug 2018, 1:29 PM
Meet Mehta
Meet Mehta - avatar