The ratio between the two stable isotopes of nitrogen, 14 N and 15 N, is well measured in the terrestrial atmosphere (∼ 272), and for the pre-Solar nebula (∼ 441, deduced from the Solar wind). Interestingly, some pristine Solar System materials show enrichments in 15 N with respect to the pre-Solar nebula value. However, it is not yet clear if, and how, these enrichments are linked to the past chemical history, due to the limited number of measurements in dense star-forming regions. In this respect, dense cores believed to be precursors of clusters containing also intermediate-and high-mass stars are important targets, as the Solar System was probably born within a rich stellar cluster. The number of observations in such high-mass dense cores has remained limited so far. In this work, we show the results of IRAM-30m observations of the J=1-0 rotational transition of the molecules HCN and HNC, and their 15 N-bearing counterparts, towards 27 intermediate/high-mass dense cores divided almost equally in three evolutionary categories: high-mass starless cores, high-mass protostellar objects, and ultra-compact Hii regions. We have also observed the DNC(2-1) rotational transition, in order to search for a relation between the isotopic ratios D/H and 14 N/ 15 N. We derive average 14 N/ 15 N ratios of 359±16 in HCN and of 438±21 in HNC, with a dispersion of about 150-200. We find no trend of the 14 N/ 15 N ratio with the evolutionary stage. This result agrees with what found from N 2 H + and its isotopologues in the same sources, although the 14 N/ 15 N ratios from N 2 H + show a dispersion larger than that in HCN/HNC. Moreover, we have found no correlation between D/H and 14 N/ 15 N in HNC. These findings indicate that: (1) the chemical evolution does not seem to play a role in the fractionation of nitrogen; (2) the fractionation of hydrogen and nitrogen in these objects are not related.