Why did the US two atomic bombs on japan?

It was near the end of World War 2, and Japan wouldn't surrender with no terms to the US, so President Harry S Truman gave the order to drop 2 atomic bombs on Japan. One oh Hiroshima, the other on Nagasaki.

Japan surrendered then.