Getting Started with Adobe After Effects - Part 6: Motion Blur


Upload Image Close it
Select File

This challenge though does not have any resemblance with the real time problem directly, but it measures about logical thinking. The problem is all about finding the factorial of numbers

TSQL Beginners Challenge 3 - Find the Factorial

Solution to TSQL Beginners Challenge3

Jun 8 2011 8:57AM by Pop Adrian   

Solution to TSQL Beginners Challenge 3

--TSQL Beginners Challenge 3 - Find the Factorial 
DECLARE @Fact TABLE(Nums INT)
INSERT INTO @Fact 
SELECT 0 UNION ALL 
SELECT 1 UNION ALL 
SELECT 3 UNION ALL 
SELECT 5 UNION ALL 
SELECT 10;

--SELECT * FROM @Fact;
--The solution:
with input as 
(select 
Nums as Nums, 
case when Nums>0 then Nums when Nums<=0 then 1 end as Fact from @Fact 
where Nums>=0 union all select Nums, Fact-1 from input where Fact>1)
select distinct Nums, POWER(10,SUM(LOG10(Fact))) as Factorial from input group by Nums;
--select Nums, (case when Nums>1 then Nums-1 else 1 end)*Nums from @Fact inner join input on input.Nums = Input

Tags:


Pop Adrian
291 · 0% · 147
0
Liked



Submit

Your Comment


Sign Up or Login to post a comment.

    Copyright © Rivera Informatic Private Ltd Contact us      Privacy Policy      Terms of use      Report Abuse      Advertising      [ZULU1097]