The of the 45 numbers is 9.the average of the first 20 is 10 and the average of the last 24 is 8.find the 21st number.

I have solved please check this.
9=x/45 ,so x=415.
10=x/20, x=200
and 8=x/24, x=192
So,415-(200+192)=23.answer
Is this way and answer correct?

2 answers

I will assume you meant:
The average of the 45 numbers is 9

let the sum of all 45 be x
x/45=9
x=415 <--- you had that

let the sum of the first 20 be a
a/20=10
a = 200

let the sum of the last 24 be b
b/24 = 8
b = 192

looks like the 21st number is no included, so
the 21st number is x - a - b
= 415-200-192 = 23

you had that, and your answer is correct

My only objection to your solution is your choice of the variable x to represent two different quantities
Thank you :)