Firstly, login to your blogger account, go to your dashboard, where you have to click the "Layout" link(beside the settings link) of your blog. make sure you are on the "page elements" sub-tab, where you can easily add and arrange page elements.
You will now add a gadget by clicking the "Add a Gadget" link
From the popup that appears, you can add many gadgets to your blog, this time we need to scroll down to the HTML/JavaScript option and click the "+" sign beside it to add it to your blog
This will open a final popup where you paste your code(HTML or JavaScript) under the "content" textarea. Give it a title on the title textbox and click the button to "save changes"