Need some help regarding this program.
I had done a similar program having output as:-
S A I F E E
S A I F E
S A I F
S A I
S A
S
Its output is as follows:-
class Name
{
public static void main(String args[])
{
String s="SAIFEE";
int num=s.length();
while(num>0)
{
for(int j=0;j<num;j++)
{
System.out.print(" "+s.charAt(j)+" ");
}
System.out.println();
num--;
}
}
}
But I'm unable to find a logic to develop a code for this program:-
Input: Tiger
Output:-
Tigeregit
igeregi
gereg
ere
r
ere
gereg
igeregi
Tigeregit
I'll be obliged if anyone helps me out on this.
Thanks in advance :icon_cry: