Patrón usando recursión en Java
1234567891011121314151617181920212223242526
import java.lang.String;import java.util.Scanner;public class Main{ // function to print the required pattern public static String func(int n) { //write your code he if(n<=0) { return ""; } String res=func(n-1); res=res+"*"; System.out.println(res); return res; } public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); func(n); }}
Zany Zebra