/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package pbo;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
/**
*
* @author Fandy
*/
/*
* Nama : Fandy Adam
* Stambuk : E1E1 09 053
* Tugas Mata Kuliah : PBO
* Jurusan : IT
*
* SOAL 5 : PALINDRAME
*/
public class soal5 {
/**
* @param args the command line arguments
*/
public static void main(String[] args) throws IOException {
BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
System.out.println("Selamat Datang di Aplikasi Palindrame.");
System.out.print("Silakan masukkan kata : ");
String kata1 = input.readLine().trim();
String kata2 = "";
for(int i=kata1.length()-1; i>=0; i--) {
kata2 = kata2 + kata1.charAt(i);
}
System.out.print("Kata \""+kata1+"\" adalah ");
if(kata1.equalsIgnoreCase(kata2))
System.out.println("palindrame");
else
System.out.println("bukan palindrame");
}
}
Subscribe to:
Post Comments (Atom)






0 comments:
Post a Comment