7. Write a function in C or Java that accepts integer n as an input and returns the following result.
(15%)