hi friends , if I give input for @a is 7,8,10,11,12,13 and ect . I will get perfect answer .but when will I give input for @a is 9 or 4 , I did not get answer. pls try to solvecodings : check value is prime or not declare @a int = 13declare @b int = 1declare @b1 int = 0while(@a >= @b)begin if (@a%@b = 0) begin set @b1 = @b1 + 1 end else if (@b1 > 2) begin print 'The value is not prime' break end set @b = @b+1end-- PRINT @B1 -- PRINT @B-1 if (@b1 = 2) AND (@b-1 = @a) print 'The value is prime'
↧