p = 7.5
q = 12.5
average = (p + q) / 2
print(average)
#source code --> clcoding.com
Explanation:
Define Variables:
p = 7.5 and q = 12.5 are floating-point numbers.
Calculate Average:
First, we add p and q:
7.5+12.5=20.0
Then, we divide the sum by 2 to get the average:
20.0÷2=10.0
Print the Result:
print(average) displays the calculated average.
Output:
10.0
0 Comments:
Post a Comment