For this question, we are going to use two formulas to find the energy, the first one is already described in the question itself, which is:
E = h*f
Where:
E = energy
h = planck's constant, 6.63*10^-34
f = frequency, which we have to find
And the next formula will be:
f = c/λ
Where:
f = frequency
c = speed of light, 3.00*10^8 m/s
λ = wavelenght, 510 nm
Now let's solve the frequency formula first:
f = 3.00*10^8/510*10^-9
f = 5.88*10^14
Now we use this value of frequency to find the energy
E = 6.63*10^-34 * 5.88*10^14
E = 3.9*10^-19 J