Wednesday 27 January 2016

write a program in java to print all letters lowercase to uppercase without using build in function.

Code:
class Lower_Upper
{
  public static void main(String args[])
  {
    String st="computer";
    int i,c;
    for(i=0;i<st.length();i++)
    {
      c=st.charAt(i);
      if(c>=97 && c<=123)
      {
        c=c-32;
       }
      System.out.print((char)c);
    }
  }
}

No comments:

Post a Comment