As machine learning methods keep developing in materials science, using machine learning to mine novel materials has become a research hotspot. For microscopic crystals, the first-principles calculation of elastic constants has always been a conventional research method. However, the first-principles calculation method is time-consuming and laborious, which limits the development of materials. In order to achieve efficient discovery of new materials, this paper proposed an improved artificial neural network (ANN) method to predict the elastic modulus of crystals improved by particle swarm optimization (PSO), which build the PSO-ANN model in use of structures and elastic constants of crystals. Experiments show that the root mean square error (RMSE) can reach within 1GPa. To verify the accuracy of the method for other crystal predictions, the MgZn2 crystal is modelled and calculated by using the first-principles calculation method. Comparing with the prediction method proposed, the average error of the predicted elastic constants is within the range 5.6%.