Advertisement
satriafu5710

Menentukan Huruf Vokal atau Konsonan Java

Feb 25th, 2022
1,417
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.69 KB | None | 0 0
  1. package com.tutorial;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class Main {
  6.     public static void main(String[] args) {
  7.  
  8.         Scanner userInput = new Scanner(System.in);
  9.  
  10.         char huruf;
  11.  
  12.         System.out.println("\n\t Menentukan Huruf Vokal atau Huruf Konsonan \n");
  13.  
  14.         System.out.print(" Inputkan Hurufnya : ");
  15.         huruf = userInput.next().charAt(0);
  16.  
  17.         if (huruf == 'a' || huruf == 'i' || huruf == 'u' || huruf == 'e' || huruf == 'o') {
  18.  
  19.             System.out.println("\n" + huruf + " adalah huruf VOKAL");
  20.         }
  21.  
  22.         else {
  23.  
  24.             System.out.println("\n" + huruf + " adalah huruf KONSONAN");
  25.         }
  26.  
  27.         System.out.println();
  28.     }
  29. }
  30.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement