English, asked by MalayaDhal, 5 months ago

Write a program in Java to enter a sentence and display those words which do not have any vowels.

Example:- String s=" SKY IS CLOUDY";
OUTPUT== SKY
NO SPAMMING❎❎
Illogical Answers will be reported.​

Answers

Answered by bhagyashreehappy123
1

import java.util.Scanner;

public class KboatMaxVowelWord

{

public static void main(String args[]) {

Scanner in = new Scanner(System.in);

System.out.println("Enter a sentence:");

String str = in.nextLine();

str = str + " ";

String word = "", mWord = "";

int count = 0, maxCount = 0;

int len = str.length();

for (int i = 0; i < len; i++) {

char ch = Character.toUpperCase(str.charAt(i));

if (ch == 'A' ||

ch == 'E' ||

ch == 'I' ||

ch == 'O' ||

ch == 'U') {

count++;

}

if (ch == ' ') {

if (count > maxCount) {

maxCount = count;

mWord = word;

}

word = "";

count = 0;

}

else {

word += ch;

}

}

System.out.println("The word with maximum number of vowels: "

+ mWord);

}

}

Answered by punyaslok68
0

Answer:

hi i am punyaslok i need 5 brainliest ans to go to next level so mark my 5 ans as BRAINLIEST please

Similar questions