For availing a branch change in IITs/NITs following conditions have to be satisfied:
1 You have to maintain an aggregate CGPA of at least 8.0 at the end of first year. This is the toughest part.
2 The student count in the branch you are entering should not exceed by 50 percent of what it was previously
3 The students count in the branch you are leaving should not fall below 50 percent of what it was previously.
Note: the last two points( percent) may vary with individual IITs and NITs. All in all it is a great opportunity to change to the branch of your interest which you could not get in the first place, due to any reason.
So all in all, you have to work extremely hard in your first year to avail a Branch change at an IIT. My advice would be to try to opt for CS during admission itself ( even if it requires you to opt for a lower ranked IIT or an NIT because a stream change is a risk taken in some ways)
Good luck!