AF
HomeTagSubmit NotesAsk AnythingLoginSubscribe Us
AF
1. Feel Free to ask and submit anything on Anyforum.in and get satisfactory answer
2. Registration is not compulsory, you can directly login via google or facebook
3. Our Experts are looking for yours ?.



corejava-programming: java program to print pyramid of stars using for loop

*
**
***
****
*****
******
*******
********
*********
**********
**********
*********
********
*******
******
*****
****
***
**
*

corejava x 352
programming x 168
Posted On : 2016-05-31 22:06:00.0
profile Saksham Kumar - anyforum.in Saksham Kumar
72933916223
up-rate
3
down-rate

Answers


public class PrintStarsPyramid {

public static void main(String[] args) {

int numberOfStars=10;

for(int i=1; i<= numberOfStars ;i++){
for(int j=1; j <=i; j++){
System.out.print("*");
}

System.out.println("");

}

for(int i=numberOfStars; i>0 ;i--){
for(int j=0; j < i; j++){
System.out.print("*");
}
System.out.println("");
}

}

}

Posted On : 2016-05-31 22:40:48
Satisfied : 1 Yes  0 No
profile Rishi Kumar - anyforum.in Rishi Kumar
523188221600
Reply This Thread
up-rate
5
down-rate



Post Answer
Please Login First to Post Answer: Login login with facebook - anyforum.in