Step 1: Condition for positive integral roots.
Equation:
\[
x^2-n=0 \Rightarrow x=\pm\sqrt{n}
\]
Roots are integers only if \(n\) is a perfect square.
Step 2: Count perfect squares between 1 and 40.
Perfect squares \(\le 40\):
\[
1,4,9,16,25,36
\]
Total = 6 numbers.
Step 3: Total possible values of \(n\).
\[
n=1,2,3,\ldots,40
\Rightarrow 40 \text{ outcomes}
\]
Step 4: Probability.
\[
P=\frac{6}{40}=\frac{3}{20}
\]
Final Answer:
\[
\boxed{\frac{3}{20}}
\]