a program to check whether the number is valid for several condition