In this assignment you will write functions for two programs (Program 1 and Program 2) that will include your functions. Each program will be well documented (commented) and submitted in a separate document. Program 1 First write functions for the following: A function “circleArea (radius)” that returns the area of a circle having the given radius. (The formula is A = πr^2 .) A function “circlePerimeter(radius)” that returns the perimeter of a circle having the given radius. (The formula is P = 2πr .) Then write a main program that uses these functions to compute the area and perimeter of a circle given the radius. The program should prompt the user for the radius and then print out the area and perimeter. A sample run for the program is as follows: Enter the radius of the circle: 5 Area of the circle is 78.5 Perimeter of the circle is 31.4 Program 2 Write a function to compute the nth number of the following series: Given a value x, multiply all the non-zero digits of x together and then add that value to x to get the next number in the series. The function should be named: some_series. 1, 2, 4, 8, 16, 22, 26, 38, 62, 74, 102, 104, 108, 116, 122, 126, 138, 162, 174, 202, 206, 218, 234, 258, 338, 410, 414, 430, 442, 474, 586, 826, 922, 958, 1318, 1342, 1366, … Write a main program that prompts the user to enter “n” and prints out the nth number of the series. A sample run for the program is as follows. Enter a positive integer: 6 The 6th number of the series would be 22

Don't use plagiarized sources. Get Your Custom Essay on

Functions Program

Just from $13/Page