-
Algorithm
Does any have a algorithm that can divide A into B without using the divide
sign (/) or the multiplication sign ( * ).
-
Algorithm (reply)
Hi.
Divide is nothing but a series of sibstraction.
here is an example. It will not give any decimal
values. from this u can know the algorithm / logic behind it
alter function divide (@A float, @b float)
returns int
as
begin
declare @Quotient float
declare @remainder float
set @Quotient = 0
while @a >=0
begin
set @a=@a-@b
set @Quotient = @Quotient+1
end
return @Quotient-1
end
--to run this
select dbo.divide(10,2)
------------
kevin at 5/22/2002 9:58:40 PM
Does any have a algorithm that can divide A into B without using the divide
sign (/) or the multiplication sign ( * ).
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|