An agricultural or horticultural fungicide contains as an active ingredient thereof at least one compound selected from the group consisting of nitrogenated heterocyclic compounds represented by formula (I) (wherein, R represents a group represented by CR 1 R 2 R 3 or a cyano group, R 1 to R 3 represent hydrogen atoms, alkyl groups or hydroxyl groups, or the like, X 1 represents a halogeno group or the like, m represents an integer of 0 to 5, X 2 represents a halogeno group or the like, n represents an integer of 0 to 3, B represents a carbon atom or a nitrogen atom, D represents a 5- to 7-membered hydrocarbon ring, and A 1 to A 4 represent carbon atoms or nitrogen atoms, provided that A 1 to A 4 do not all represent carbon atoms when B represents a carbon atom) and salts thereof.