accept a sentence and print the words that begin and end with the same letter
Answers
Answered by
1
i can't understood ur question properly
Answered by
4
Import java .util.Scanner;
Class letters
{
Public static void main (String args [])
{
Scanner in =new Scanner (System.in);
System.out.println ("enter a sentence");
String s=in.nextLine ();
s=s+" ";
Int l =s.length ();
String z=" ";
for (int m=0; m <l; m++)
{
char c=s.charAt (m);
If (c!=32)
z=z+c;
Else
{
Int l2= z.length ();
Char c3=z.charAt (0);
Char c4=z.charAt (l2-1);
If (c3==c4)
System.out.println (z);
z=" ";
}
}
}
}
Class letters
{
Public static void main (String args [])
{
Scanner in =new Scanner (System.in);
System.out.println ("enter a sentence");
String s=in.nextLine ();
s=s+" ";
Int l =s.length ();
String z=" ";
for (int m=0; m <l; m++)
{
char c=s.charAt (m);
If (c!=32)
z=z+c;
Else
{
Int l2= z.length ();
Char c3=z.charAt (0);
Char c4=z.charAt (l2-1);
If (c3==c4)
System.out.println (z);
z=" ";
}
}
}
}
Similar questions
Social Sciences,
8 months ago
Social Sciences,
8 months ago
CBSE BOARD X,
1 year ago
Math,
1 year ago
Hindi,
1 year ago
History,
1 year ago
Social Sciences,
1 year ago