Click here to Skip to main content
15,883,929 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Java
/*
 * 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);

}

}
Posted
Comments
Sergey Alexandrovich Kryukov 23-Sep-14 23:33pm    
All right, this is some code dump. So what? Any questions?
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900