Write a program in java to display only those words of a string which carries same letter in both the end and also display how many such words found.
Answers
Answered by
2
Answer:
Explanation:
import java.util.Scanner;
public class KboatNameInitials
{
public static void main(String args[]) {
Scanner in = new Scanner(System.in);
System.out.println("Enter a name of 3 or more words:");
String str = in.nextLine();
int len = str.length();
System.out.print(str.charAt(0) + " ");
for (int i = 1; i < len; i++) {
char ch = str.charAt(i);
if (ch == ' ') {
char ch2 = str.charAt(i + 1);
System.out.print(ch2 + " ");
}
}
}
}
Answered by
3
Answer:
hi Gaurav kkrh
I got my new rank
reply
Similar questions
English,
8 hours ago
CBSE BOARD X,
8 hours ago
English,
16 hours ago
Math,
16 hours ago
Math,
8 months ago
Social Sciences,
8 months ago
India Languages,
8 months ago