by Dinesh Thakur Category: array

Algorithm For ReverseIT:


step 1: set s="Dat saw 1was Tad"

step 2: set len=s.length()

step 3: create two character array c[], cl[] of size len

step 4: initialize i=0

step 5: repeat through step-7 while (i < len)

step 6: c[i]=s. charAt(i)

step 7: i=i+ 1

step 8: initialize j=0

step 9: repeat through step-11 while (j < len)

step 10: c1[j]=c[len-1-j]

step 11: j=j+ 1

step 12: string sl =new String(c1)

step 13: print sl

step 14: Exit


Here is the Java Example for ReverseIT:

public class ReverseIT

       public static void main(String[] args)
            String s="Dot saw I was Tod";
            int len=s.length();
            char[]c=new char[len];
            char[]c1=new char[len];
               for(int i=0;i<len;i++)
                      for(int j=0;j<len;j++)
                               String sl=new String(c1);

A string

About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.C.A, MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.

Related Articles