Type Here to Get Search Results !

Star Pattern using Java - Height (3) and Base (5).

0

Star Pattern Using Java - Height(3) and Base(5).



Print a right-angled triangle of height 3 (lines) and base 5 (stars).

User Task :-

No input. You just need to print out the triangle using System.out.println in Java.

Output :- 

Print the triangle of height 3 and base 5 as shown.

Illustration :- 

*
***
*****

Common Mistakes-
You do not need for loop here. Just use System.out.println()



Soulution :-

import java.util.*;
import java.io.*;

public class Main {
    public static void main(String args[]) {
        //your code here
        System.out.println("*");
        System.out.println("***");
        System.out.println("*****");
    }
}

Output :- 

*
***
*****

Post a Comment

0 Comments