Professional Documents
Culture Documents
Lab 4
Lab 4
Python program to demo for passing one and two arguments for same function
Answer:
# Function that takes one argument
def greet_person(name):
print("Hello,", name, "!")
# Main function
def main():
# Calling the function with one argument
greet_person("Mariam")
if __name__ == "__main__":
main()
Java a program to add two integers in a function and return the result to the calling
function
Answer:
public class AddTwoIntegers {
// Function to add two integers and return the result
static int add(int num1, int num2) {
return num1 + num2;
}