1- Write a program that prompts the user to enter 5 integers and performs the following: i- The program should have a function named add, which would take 5 integers as parameters and print the sum of those numbers. ii- The program should have a function named product, which would take 5 integers as parameters and print the product of those numbers. iii- The program should have a function named average, which would take 5 integers as parameters and print the average of those numbers. iv- The program should have a function named subtract, which would take 5 integers as parameters and print the subtraction of those numbers. After taking five integers as input from user, your program should as user whether he/she wants to add, subtract, multiply or calculate the average. You could follow a similar pattern: 1 – Press 1 to perform addition. 2 – Press 2 to perform multiplication. 3 – Press 3 to perform subtraction. 4 – Press 4 to calculate average 5 – Press 5 to exit
1- Write a
i- The program should have a function named add, which would take 5
integers as parameters and print the sum of those numbers.
-
ii- The program should have a function named product, which would take 5
integers as parameters and print the product of those numbers.
-
iii- The program should have a function named average, which would take 5
integers as parameters and print the average of those numbers.
-
iv- The program should have a function named subtract, which would take 5
integers as parameters and print the subtraction of those numbers.
After taking five integers as input from user, your program should as user whether he/she wants to add, subtract, multiply or calculate the average. You could follow a similar pattern:
1 – Press 1 to perform addition.
2 – Press 2 to perform multiplication. 3 – Press 3 to perform subtraction.
4 – Press 4 to calculate average
5 – Press 5 to exit
2- Write a program that prompts the user to enter an integer and passes that integer as a parameter to a function to calculate the factorial of that number.
-
3- Write a program that ask user to enter a string, pass that string as a parameter to a function to check whether the string is a pangram or not. Pangrams are words or sentences containing every letter of the alphabet at least once.
-
4- Write a program that takes in name and pay rate and the number of hours worked in a week by three persons, pass this information into a function and calculate the weekly pay of all persons.
Sample Output:
Person_1 earned $50.00. Person_2 earned $150.00. Person_3 earned $250.00.
Your program should also print the name of the person who got the most and the least pay during the week.
Trending now
This is a popular solution!
Step by step
Solved in 5 steps with 4 images