answer to c++ programming question “a pentagonal number is defined as n(3n-1)/2 for n=1,2 and so on write a function…

answer to c++ programming question “a pentagonal number is defined as n(3n-1)/2 for n=1,2 and so on write a function that returns a pentagonal number