-- Please Scan Number 1 To 100
-- Find Numbers That Are Divided By 3 OR 5 OR Both And Returns A Whole Number (Integer).
-- If The Number Divided By 3 Print - The Number + ' Is Divided by 3'
-- If The Number Divided By 5 Print - The Number + + ' Is Divided by 5'
-- If The Number Divided By 3 And 5 Print - The Number + ' Is Divided by 3 and 5'
Declare @runner int
Set @runner = 1
While (@runner <= 100)
Begin
if((@runner%3) = 0 and (@runner%5) = 0)
begin
print Cast(@runner as varchar(20)) + ' Is Devided By 3 & 5'
end
else
if(@runner%3) = 0
begin
print Cast(@runner as varchar(20)) + ' Is Devided By 3'
end
else
if(@runner%5) = 0
begin
print Cast(@runner as varchar(20)) + ' Is Devided By 5'
end
Set @runner = @runner + 1
End;