Computer Science, asked by Debanjaly1, 1 year ago

Print this pattern using for loop in java

Attachments:

Answers

Answered by QGP
4
public class Pattern
{
    public static void main(String[] args)
    {
        String str = "DCBA";
        int len = str.length();
        
        for(int i=len;i>0;i--)
        {
            System.out.println(str.substring(0,i));
        }
    }
}
Similar questions