A novel series of interesting N- (pyrazol-5-yl)pyridine-3,5-dicarbonitrile, pyrazolo[1,5-a]pyrido[3,2e]pyrimidine-7-carbonitrile and pyrazolo[4,3-e]pyrido[1,2-a]pyrimidine-6,8-dicarbonitrile derivatives were prepared via the versatile readily accessible 7-aminopyrazolo[1,5-a]pyrimidin-5(4H)-one or 2-cyano-N-(pyrazol-5-yl)acetamide derivatives with arylaldehydes and malononitrile in ethanol containing piperidine.