A new synthesis of 1, 2, 4-triazoles and 1, 2, 4-oxadiazoles has been developed. N'-Acyl-N, N-dimethylamidines, which were prepared in excellent yields by reactions of amides with N, N-dimethylalkanamide dimethyl acetals, reacted with hydrazines or hydroxylamine in acetic acid to give 1, 2, 4-triazoles or 1, 2, 4-oxadiazoles, respectively, in excellent yields.