The function accepts 3 positive integers 'a', 'b' and 'c' as its arguments. Implement the function to return
(a + b), if c= 1
(a - b), if c= 2
(a x b), if c = 3
(a/b), if c = 4
Answers
Answer:
The function accepts 3 positive integers 'a', 'b' and 'c' as its arguments. Implement the function to return:
Answer is:
def test(a,b,c):
if(c==1):
return (a+b)
elif(c==2):
return (a-b)
elif( c==3):
return (a*b)
else:
return (a/b)
p= int (input("enter value of a"))
q= int (input("enter value of b"))
r= int (input("enter value of c between 1 to 4"))
res=test(p,q,r)
print(res)
Explanation:
Following given code is in python programming language:
python is a popular programming language. It is dynamic, interpreted, user friendly language and very easy to understand
in this def is used to define a function, for taking integer input int (input()) syntax is used .
In the first line we define a function name "test" which accepts 3 integer 'a', 'b', 'c'
To know about more click here,
https://brainly.in/question/18905944
To know about more click here,
https://brainly.in/question/16088081
#SPJ2