Let total no. of goats be x.
No. of goats died due to flood =
10% of x = x/10.
Remaining goats = x - x/10 = 9x/10.
Goats died due to disease
= 40% of 9x/10 = 36x/100.
Rest goats = 9x/10 - 36x/100 = 54x/100.
Now, As per the question,
54x/100 = 594
x = 594*100/54 = 1100.
So, Original number of goats = 1100.