This is the pattern I'm trying to print: Required pattern
This is the code I have written:
for(int c = s.length; c >= 1; c--)
{
for (int d = c; d >= 0; d--)
{
char y = s.charAt(d);
System.out.print(y);
}
System.out.println();
}
Sadly, the program isn't compiling. What do I change in this code to make it print the required pattern?
Aucun commentaire:
Enregistrer un commentaire