Others have already given the answer, but I thought it might be useful to show in some detail how to arrive at it:
Let $X \in \{1,\dotsc,10\}$ be the first random variable, and let $Y \in \{1,\dotsc,100\}$ be the second. The probability that $Y \le 5X$, given that $X$ has the value $x$, is
$\mathrm P(Y \le 5X \;|\; X=x) = \mathrm P(Y \le 5x) = \frac{5x}{100}.$
$X$ takes all values with equal probability, so, for any given $x \in \{1,\dotsc,10\}$, $\mathrm P(X=x) = \frac{1}{10}$. Therefore, the probability that $X=x$ and $Y \le 5X$ is
$\mathrm P(Y \le 5X \text{ and } X=x) = \mathrm P(Y \le 5X \;|\; X=x)\; \mathrm P(X=x) = \frac{5x}{100} \frac{1}{10} = \frac{5x}{1000}.$
To get the marginal probability that $Y \le 5X$, we then simply need to sum over all possible values of $X$:
$\mathrm P(Y \le 5X) = \sum_{x=1}^{10}\; \mathrm P(Y \le 5X \text{ and } X=x) = \sum_{x=1}^{10}\frac{5x}{1000}.$
The final step is either remembering the formula for the sum of an arithmetic progression or just working it out by hand:
$\sum_{x=1}^{10}\frac{5x}{1000} = \frac{5}{1000} \sum_{x=1}^{10}\; x = \frac{5}{1000} (1 + \cdots + 10) = \frac{5}{1000} 55 = \frac{275}{1000} = \frac{11}{40}.$
Thus, the probability that your pseudocode returns true is $\frac{275}{1000} = \frac{11}{40}$, and so it can be replaced by
if (rand(1000) <= 275) return TRUE;
or even by
if (rand(40) <= 11) return TRUE;