$ ./guess_the_languageProblem Solving — predict the output
Problem Solving — predict the output · medium · #249

What is the output?

fmt.Println(-7/2, -7%2)
  1. -4 1
  2. -3 1
  3. -4 -1
  4. -3 -1
Go integer division truncates toward zero (-3), and the remainder takes the sign of the dividend (-1). Python would give -4 1.
Play Problem Solving ▸