Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --4
- declare @i int = 10000
- declare @sum int = 0
- while @i < 100000
- begin
- declare @number varchar(5) = cast(@i as varchar)
- declare @tempSum int = 0
- declare @j int =1
- while (@j <= 5)
- begin
- set @tempSum = @tempSum + SUBSTRING(@number, @j, 1)
- set @j=@j+1
- end
- if @tempSum = 12
- set @sum = @sum + @i
- set @i = @i + 1
- end
- select @sum
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement