Explanation of a simple algorithm's Big O complexity
The inner loop is $O(\sqrt{i})$, you are correct. Since $i\leq n$, then $\sqrt{i}\leq \sqrt{n}$, and we have
$n\times\sqrt{i}\leq n\times\sqrt{n}$. Hence the complexity is  $O(n\sqrt{n})$.