A charged meson can still carry zero baryon number. Exact arithmetic here means exact results for the stated model inputs; measured inputs still carry uncertainty and significant-figure limits.
highlighted = computed this step
A quark and antiquark can be charged
The up quark contributes 2 and the anti-down contributes 1, giving scaled charge 3.
2+1=3
Baryon number cancels in a meson
The quark contributes 1 and the antiquark contributes -1, so the scaled baryon total is 0.