This is not homework session. Your approach is very limited with hard coding the values. What if data is like this?
create table #table1(steps int)
insert into #table1(steps)values(1)
insert into #table1(steps)values(2)
insert into #table1(steps)values(3)
insert...