wrote if statement for calc