Tuesday, 7 April 2020

Program: Input a character from user & if character is lower case then convert it into upper case & vice-versa

import java.util.Scanner;
public class ATS
{
public static void main(String[]args)
{
Scanner in = new Scanner(System.in);
System.out.println("Enter any character"); 
char ch = in.next().charAt(0);   
if(ch >=65 && ch<=90)       
            ch = Character.toLowerCase(ch);
        else if(ch >=97 && ch<=122)       
            ch = Character.toUpperCase(ch);
System.out.println(ch);
}
}

No comments:

Post a Comment