Computer Science, asked by Rajinderkhurana352, 9 months ago

write a program to input a string and change the case of the string and print the new string ​

Answers

Answered by gourihalder1111
1

THE PROGRAM IS IN JAVA

import java.io.*;

class New_String

{

public static void main(String args[ ])throws IOException

{

BufferedReader br=new BufferedReader(new InputStreamReader(System.in));

System.out.println("Please enter a string");

String st= br.readLine();

int i;

int l= st.length();

char ch;

for(i=0;i<l;i++)

{

ch= st.charAt(i);

if(ch>=65 && ch<=90)

ch= ch+32;

if(ch>=97 && ch<=122)

ch= ch-32;

W= W+ch;

}

System.out.println("The new string is"+W);

}

}

Similar questions