/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package asterisk1; /** * * @author chakri */ public class Asterisk1 { private int count = 0; public void asterisk1(int n) { if(n==0) { System.out.println(); } else { System.out.print("*"); asterisk1(n-1); } } public void asterisk2( int n) { if(n==0) { return; } else { asterisk1(n); asterisk2(n-1); } } public void asterisk3( int n,int m) { if( n == 0) { System.out.println(); } else { asterisk1(m); asterisk3(n-1,m+1); } } } public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.print("Enter a number: "); int n = input.nextInt(); Asterisk1 access = new Asterisk1(); access.asterisk2(n,1); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)