A java program to print half pyramid

Abdulhakim Haliru
WeCode NG
Published in
1 min readOct 2, 2017

Hey guys, So today I thought to share something for fun. Feel free to submit your own codes in your preferred language. We are happy to publish it.

You may also write codes to print a full pyramid and send in.

package com.leproghrammeen;/* Print half pyramid using java */public class Main {

public static void main(String[] args) {

int ros = 5;

for (int i = 0; i <= ros; i++) {



for (int j = 0; j <= i ; j++) {
String str = "*";


System.out.print(str );


}
System.out.print("\n");

}
}

}

This is what it should look like :)

--

--

Abdulhakim Haliru
WeCode NG

Solutions Developer working with clients in Nigeria’s Fintech space and co-convener of Wecode.ng