There are 8 persons in total (4 boys + 4 girls)
So the number of ways in which 8 persons can be arranged is 8! ways.
Let us consider the 4 girls as a single person so there are now 5 persons in total (4 boys + 4 girls as one group or one person). So the number of ways in which 5 persons can be arranged is 5! ways and also the 4 girls can sit among themselves in 4! way so the total number of ways of seating this group of 5 is 5!×4! ways .
So the total number of ways in which 4 boys and 4 girls can be seated so that not all the girls sit together is given by= (Total no. of ways in which all 8 can sit)-(No. of ways the group of 5 can sit where the 4 girls all together is taken as a single person)
=> 8! - 5!×4! ways
=>37440 ways.