Start by thinking this is a projectile motion problem:
using the formula
yf=yi+(viy)t-1/2g(t)^2
where you know that your y final and y initial are zero (ground level the muzzel starts on floor and comes to the floor) and velocity initial in the y direction is viy= 30m/s SIN 40 and g is gravity (9.8 m/s) just put in the formula and solve for t=3.93 seconds. <-- thats how long the ball is in flight. to answer about range use this time value and formula
xf=xi+vix(t)
and xf-xi=delta x =your range.
therefore range= 30m/sCOS40(3.93s)=
90.31 m. Im not sure if its right but the logic is legit.