import java.io.*;
class Strup
{
public static void main(String args[])
{
int i;
System.out.println("Enter the Sring:");
DataInputStream d=new DataInputStream(System.in);
try
{
String str=d.readLine();
char a[]=str.toCharArray();
for(i=0;i<a.length;i++)
{
if((a[i]>='a')&&(a[i]<='z'))
{
a[i]=(char)((int)a[i]-32);
}
}
for(i=0;i<a.length;i++)
{
System.out.print(a[i]);
}
}
catch(Exception e)
{
System.out.println(e);
}
}
}
Output:
class Strup
{
public static void main(String args[])
{
int i;
System.out.println("Enter the Sring:");
DataInputStream d=new DataInputStream(System.in);
try
{
String str=d.readLine();
char a[]=str.toCharArray();
for(i=0;i<a.length;i++)
{
if((a[i]>='a')&&(a[i]<='z'))
{
a[i]=(char)((int)a[i]-32);
}
}
for(i=0;i<a.length;i++)
{
System.out.print(a[i]);
}
}
catch(Exception e)
{
System.out.println(e);
}
}
}
Output:
No comments:
Post a Comment