Print this pattern using for loop in java
Attachments:
Answers
Answered by
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));
}
}
}
{
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