Codes for Newton Cotes formulas