Tuesday, March 23, 2010

Reverse Cases(upper c to lower c, lower c to upper c)

import java.io.*;
public class reversecase
{ public static void main(String args[]) throws IOException
  { InputStreamReader read = new InputStreamReader(System.in);
  BufferedReader br = new BufferedReader(read);
   
  System.out.println("enter");
  String s=br.readLine();
  char ch;
  for(int i=0;i  { ch = s.charAt(i);
  int a=ch;
  if(a>=65 && a<=90)
  { a+=32;
  System.out.print((char)a);
  }
  else if(a>=97 && a<=122)
  { a-=32;
  System.out.print((char)a);
  }
  else 
  System.out.print(ch);
  }
  }
}

No comments:

Post a Comment