I'm an indian student in Dublin, Ireland. I have planned a 10 day trip in Prague but I couldn't get an appointment in Czech Republic Agency. So I decided to spend a few days in Budapest, Hungary as well since I got an appointment for Hungary Schengen Visa. Is it ok to do so? Also my arrival and departure would be in and from prague, so i will take the bus from prague to budapest and vice versa.
What you're doing is called visa-shopping, and it's frowned upon by the Schengen countries.
The rules say that you should apply to the country that is the main purpose of your visit, or where you'll spend most time. For your original plan, the Czech Republic is the place to apply.
If the immigration officers suspect what's really gone on they can make life difficult for any future visa application.
It's not clear from your question, but you seem to indicate that you have already started (and possibly completed) the process with Hungary, and arranged your flights.
Changing your itinerary to spend most time in Budapest might be a solution, but it's a six hour drive (longer by bus) from Prague to Budapest, passing through Austria or Slovakia on the way. It's going to be difficult to explain, then, why you flew to Prague for a holiday in Budapest.
Changing your flights and going to Prague another time might be a better option.