i/p: zohocorporation
o/p:
z n
o o
h i
o t
c a
o r
r o
p
r o
o r
c a
o t
h i
o o
z n
public class NewClass3 {
void printsissors(String s)
{
int x=0,y=s.length()-1;
for(int i=0;i<s.length();i++)
{
for(int j=0;j<s.length();j++)
{
if(x==j || y==j)
System.out.print(s.charAt(j));
else
System.out.print(" ");
}
x++;
y--;
System.out.println();
}
}
public static void main(String args[])
{
NewClass3 ob=new NewClass3();
String s="zohocorporation";
ob.printsissors(s);
}
}
No comments:
Post a Comment