A recursive function is a function which calls itself to work on the smaller function. This program reverses a string using a recursive function.
- class Program
- {
- static void Main(string[] args)
- {
- Program p = new Program();
- p.Fun();
- Console.WriteLine("\n");
- Console.ReadLine();
- }
- public void Fun()
- {
- char c;
- if ((c = Convert.ToChar(Console.Read())) != '\n')
- Fun();
- Console.Write(c);
- }
- }
- }
Hope you find this helpful.
Abubakr MahdiPosted Aug 8, 2019, 3:41 PM
Its useful , thank you for the blog.
Pankajkumar PatelPosted Aug 1, 2019, 12:20 AM
Good one ...