Hello! So I’m doing a 30 day coding challenge where I solve a few questions every day and thought of posting them here on my blog so that you guys can join the challenge too!
Welcome to Coding challenge Day 34: Problem 1! Be sure to post your answers, queries etc in the comments!
Actually I was just going through some of my 10th grade coding stuff and came across this. Couldn’t help but put this one here!
Problem: Print a Pyramid Pattern for a given number of rows as follows:
Sample: Rows=4
Output:

Solution:
package misc;
public class Pyramid_pattern {
public static void main (String [] args){
int rows=12, f=1;;
for(int i=0; i<rows; i++,f+=2){
int t=0;
for(int j=0; j<rows-i-1; j++){
System.out.print(" ");
}
while(t<f){
System.out.print("*");
t++;
}
System.out.println();
}
}
}
Happy Learning!!