prog assignment no 2 for R added