answersLogoWhite

0


Best Answer

import java.util.Scanner;

class Vowels{

public static void main(String[]args){

int c=0;

Scanner obj=new Scanner(System.in);

System.out.println("Enter your String:");

String b=obj.nextLine();

for (int i=0;i<b.length();i++) {

if (b.charAt(i)==('a')b.charAt(i)==('e')b.charAt(i)==('u')b.charAt(i)==('i')b.charAt(i)==('o')b.charAt(i)==('A')b.charAt(i)==('E')b.charAt(i)==('U')b.charAt(i)==('I')b.charAt(i)==('O')){

c++;

}

}

System.out.println("Number of vowels found: "+c);

}

}

User Avatar

Wiki User

13y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

14y ago

private static final String VOWELS = "aAeEiIoOuU";

public static int countVowels(String sentence) {

int numVowels = 0;

for(char letter:sentence.toCharArray()) {

if(VOWELS.contains(letter)) {

++numVowels;

}

}

return numVowels;

}

This answer is:
User Avatar

User Avatar

Wiki User

13y ago

import java.io.*;

class Vowel

{

public static void main (String ss[])throws IOException

{

char n;

BufferedReader s=new BufferedReader (new InputStreamReader (System.in));

System.out.println ("Enter a Charcter");

n=s.readLine().charAt(0);

if (n=='a' n=='e' n=='i' n=='o' n=='u' n=='A' n=='E' n=='I' n=='O' n=='U')

System.out.println ("Entered character is a Vowel");

else

System.out.println ("Entered character is not a Vowel");

}

}

This answer is:
User Avatar

User Avatar

Wiki User

14y ago

import java.io.*;

class PercentVowels

{

protected static void main()throws IOException

{

BufferedReader in=new BufferedReader(new InputStreamReader(System.in));

System.out.print("Enter the String: ");

String s=in.readLine();

short a=0;

for(short i=0;i<s.length();i++)

{

char ch=s.charAt(i);

if(ch=='A'ch=='a'ch=='e'ch=='E'ch=='I'ch=='i'ch=='O'ch=='o'ch=='U'ch=='u')

a++;

}

float b=(a*100)/s.length();

System.out.print("Perncentage of vowels= "+b);

}

}

This answer is:
User Avatar

User Avatar

Wiki User

10y ago

String vowels="AEIOU";

int count=0;

char[] charArray =givenExampleString.toCharArray(); for(int i=0; i<givenExampleString.length();i++){

if(vowels.contains(charArray[i]){

count++

}

System.out.print("Vowels count "+count);

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Write a program to check wheather a vowel or not by using if else construct in javac?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

How do you write a pesuedocode to check wheather a given no is odd or even while not using 2?

doo doo


Write a program By using if else statement to read a number and check whether it is positive or negative?

write a c++program by using if statement to read a number and check whether it is positive or negative


What is the wheather like in Dubai tomorrow?

75F and sunny check www.weather.com


Write a shell program to check and display 10 leap years?

dono


Write a C program that takes a binary file as input and finds error check using different mechanisms?

write a c program that takes a binary file as input and finds error check using different mechanisms.


How do you write a C program to check whether the number is odd or even Ps-using DEV complier?

To write a C program to determine if something is odd or even you need to be a programmer. To write a program in C is complicate and only done by programmers.


Do cruise's check you for weapons?

depends wheather its going up the river nile


Can you write a C program to check whether a string is an IP address or not?

Use the Exception class and type converters.


Write a program that takes a binary file as input and finds error check using different mechanism?

networking


Write programs for String Reversal and Palindrome check?

Write your program and if you are having a problem post it here with a description of the problem you are having. What you are asking is for someone to do your homework for you.


Shell program for gcd of three given numbers?

write a shell program for finding out gcd of three given numbers? write a shell program for finding out gcd of three given numbers? write a shell program for finding out gcd of three given numbers? check bellow link http://bashscript.blogspot.com/2009/08/gcd-of-more-than-two-numbers.html


Lab manual in mca 1st sem from ignou?

write a program in C to check whether a given number is apalindrome or not