Programming Blog

This blog is about technical and programming questions and there solutions. I also cover programs that were asked in various interviews, it will help you to crack the coding round of various interviews

Monday, 27 March 2017

Java program to print String in Random Order of upper and lower case

import java.util.*;
public class RandUPPERLOWER {
private static Scanner s;
public static void main(String[] args)
{
System.out.println("enter the Strting :");
s = new Scanner(System.in);
String str=s.nextLine();
char str1[]=new char[100];
for(int i=0;i<str.length();i++)
{
str1[i]=str.charAt(i);
}

for(int i=0;i<str.length();i++)
{
if(i%2==1)
{
System.out.print(Character.toUpperCase(str1[i])); }
else
{
System.out.print(Character.toLowerCase(str1[i])); }
}
}
}


No comments:

Post a Comment