A program for grade using function