Recursion Output Practice - Part 1 (Example - 1)

PHOTO EMBED

Sun Feb 06 2022 20:25:24 GMT+0000 (Coordinated Universal Time)

Saved by @Uttam #java #gfg #geeksforgeeks #lecture #recursion #intro #basecase #recursivefunction

import java.io.*;
import java.util.*;

class GFG {

	
	static void fun(int n)
	{
		if(n == 0)
			return;

		System.out.println(n);

		fun(n - 1);

		System.out.println(n);
	}
    public static void main(String [] args) 
    {
        fun(3);
    }

}
content_copyCOPY

OUTPUT : ----------- 3 2 1 1 2 3