Program 22:- Write the following numeric expression in Python and evaluate it.
2+8P/2 - (P-Q)(P+Q)/2 + 4* (P+Q)/2
Consider the value of variables P and Q as 4 and 2, respectively.
Answers
Answered by
3
P = 4
Q = 2
Z =(2+8*P)/2-((P-Q)*(P+Q))/2+4*((P+Q)/2)
print('(2+8*P)/2-((P-Q)*(P+Q))/2+4*((P+Q)/2)')
print('Where P = ',P,' and Q = ', Q)
print('Answer of above expression = ',Z)
*Output*
(2+8*P)/2-((P-Q)*(P+Q))/2+4*((P+Q)/2)
Where P = 4 and Q = 2
Answer of above expression = 23.0
Similar questions