What's the difference between a ramjet and scramjet?

First thing to note is how converging or diverging geometry affects flow. The diagram below shows how a converging shape will speed up subsonic flows and slow down supersonic flows while a diverging shape slows down subsonic flows and speeds up supersonic flows.


source

Ramjet (operational between Mach 3 and 6):
As you can see in the image below, there is no compressor or turbine. The converging shape causes the incoming supersonic flow to increase its pressure and temperature at the cost of speed reduction. Then heat is added in the combustion chamber and the converging geometry causes the subsonic flow to speed up, pass mach 1, and then flow through a diverging geometry which causes the supersonic flow to speed up (similar to converging-diverging rocket nozzle).


source

Scramjet (operational beyond Mach 6)
Scramjet stands for supersonic combustion ramjet, so it looks a bit similar in that it has no compressor or turbine. It’s different because its design to only have supersonic flows, which is why the geometry is a bit simpler. The converging shape causes the flow’s pressure and temperature to increase prior to adding heat and then the diverging shape causes the supersonic flow to speed up again.

source

The main difference between the two is the speeds at which they are optimized to fly at and the range of speeds of their internal flows. Here’s a good video to learn more as well!