R_Code-12.r
Problem Statement
R_Code-12.r
Write a custom function named calculate_area that takes two parameters: length and width. The width parameter should have a default value of 5. The function should print the product of the two parameters. Finally, call your function passing only the value 12 for the length.
Source Code
r
# Write a custom function named calculate_area that takes
# two parameters: length and width. The width parameter should have
# a default value of 5. The function should print the product of the
# two parameters. Finally, call your function passing only the value 12 for the length.
calculate_area <- function(length, width = 5) {
print(length * width)
}
calculate_area(12)1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10