Write a java program to accept a string and move its each alphabet one step ahead. if alphabet Is Z, it moves to A.
Answers
Answered by
0
class Move
{
public static void main( )
{
String a="IshaanSharma";
int i,l,move=1;
l=a.length( );
for( i=0;i<l;i++)
{
char
if(b=='z')
{
move=97;
}
else if(b=='Z')
{
move=65;
}
else
{
move=move+ch;
}
System.out.print(move);
}
}
Hope you will understood@
For more java doubts ,pls follow me@
{
public static void main( )
{
String a="IshaanSharma";
int i,l,move=1;
l=a.length( );
for( i=0;i<l;i++)
{
char
if(b=='z')
{
move=97;
}
else if(b=='Z')
{
move=65;
}
else
{
move=move+ch;
}
System.out.print(move);
}
}
Hope you will understood@
For more java doubts ,pls follow me@
amannishad0512p5zxh6:
Bro, i have mistake in answer
Answered by
2
CODING
import java . io .*;
class letter
{
public static void main(String args[])throws Exception
{
DataInputStream in=new DataInputStream(System . in);
String s,s1="";
char ch;
int i;
Sys tem . out. println("Enter any string");
s=in . readLine();
s=s . toUpperCase();
for(i=0;i<s . length();i++)
{
ch=s . charAt(i);
if(ch>='A'&&ch<'Z')
{
if(ch=='Z')
s . replace('Z','A');
else
ch++;
}
s1=s1+ch;
}
System . out . println(s1);
}
}
OUT PUT
s=abcdz is the string entered by user.
s=ABCDZ is coverted into upper case
Similar questions
Math,
8 months ago
Science,
8 months ago
Computer Science,
1 year ago
Computer Science,
1 year ago
Science,
1 year ago
Math,
1 year ago