Question: 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

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 = 2r .)

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

Submit your program file, which should include the function(s) as well as the main program, named as follows: ITS-150_assignment3_1.py

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

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!