Saturday, 1 December 2012

CASE CHANGE WITHOUT USING FUNCTIONS


package Strings_ICSE;
import java.io.*;
class Alter_case
{
public static void main(String args[])throws IOException
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String s,p="";
System.out.println("Eneter the string");
s=br.readLine();
int l=s.length();
int k=0;
for(int i=0;i<l;i++)
{
k=(int)(s.charAt(i));
if((k>=65) && (k<=90))
{
k=k+32;
}
else if((k>=97) && (k<=122))
{
k=k-32;
}
p=p+(char)(k);
}
System.out.println("The string in changed case is ="+p);
}
}



No comments:

Post a Comment