import java.util.*;
public class ChangeCase
{
public static void changecase(String s)
{
for(int i=0;i<s.length();i++)
{
int ch=s.charAt(i);
if(ch>=65&&ch<=90)
{
ch=ch+32;
System.out.print( (char) ch);
}
else if(ch>=95&&ch<=122)
{
ch=ch-32;
System.out.print( (char) ch);
}
}
}
public static void main (String args[])
{
Scanner scan = new Scanner(System.in);
System.out.print("Enter a String : ");
String s=scan.nextLine();
ChangeCase.changecase(s);
}
}
public class ChangeCase
{
public static void changecase(String s)
{
for(int i=0;i<s.length();i++)
{
int ch=s.charAt(i);
if(ch>=65&&ch<=90)
{
ch=ch+32;
System.out.print( (char) ch);
}
else if(ch>=95&&ch<=122)
{
ch=ch-32;
System.out.print( (char) ch);
}
}
}
public static void main (String args[])
{
Scanner scan = new Scanner(System.in);
System.out.print("Enter a String : ");
String s=scan.nextLine();
ChangeCase.changecase(s);
}
}
No comments:
Post a Comment