TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
kalpana jaiswal
NA
45
9.6k
query about recursion function
Sep 16 2016 2:33 PM
<ol><li><span>using System; </span> </li><li> <br /></li><li><span>namespace InterviewQuestionPart4 </span> </li><li>{ </li><li> <span>class Program </span> </li><li> { </li><li> <span>static void Main(string[] args) </span> </li><li> { </li><li> Console.WriteLine(<span>"Please Enter a Number"); </span> </li><li> <br /></li><li> <span>//read number from user </span> </li><li> <span>int number =Convert.ToInt32(Console.ReadLine()); </span> </li><li> <br /></li><li> <span>//invoke the static method </span> </li><li> <span>double factorial = Factorial(number); </span> </li><li> <br /></li><li> <span>//print the factorial result </span> </li><li> Console.WriteLine(<span>"factorial of"+number+"="+factorial.ToString()); </span> </li><li> <br /></li><li> } </li><li> <span>public static double Factorial(int number) </span> </li><li> { </li><li> <span>if (number == 0) </span> </li><li> <span>return 1; </span> </li><li> <span>return number * Factorial(number-1);//Recursive call </span> </li><li> <br /></li><li> } </li><li> } </li><li>} <br /></li></ol>in the above program when condition is satisfied then its should return 1as output then how the result is return?
Reply
Answers (
1
)
Splitting a file into many files depending on a string
sendemail to Distributionemail