You are viewing a single comment's thread. Return to all comments →
DECLARE @i INT = 3 DECLARE @result VARCHAR(7000) = "2" WHILE @i <= 1000 BEGIN DECLARE @prime INT = 1 DECLARE @j INT = 2 WHILE @j < @i BEGIN IF(@i%@j = 0) BEGIN SET @prime = 2 BREAK END SET @j = @j + 1 END IF(@prime = 1) BEGIN SET @result = @result + "&" + CAST(@i AS VARCHAR) END SET @i = @i + 1 END PRINT(@result)
Seems like cookies are disabled on this browser, please enable them to open this website
Print Prime Numbers
You are viewing a single comment's thread. Return to all comments →