Skip to content

ferysuyatna/Oprec

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Oprec

package com.company;

import java.util.Scanner;

public class Main {

public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
    String tampung = "";
    String jawab = "";

    do {
        System.out.println("==== Program Palindrom ====");
        System.out.print("Masukkan kata : ");
        String kata = scan.next();

        for (int i = 0; i < kata.length() / 2; i++) {
            if (kata.charAt(i) != kata.charAt(kata.length() - i - 1)) {
                tampung = "false";
            } else {
                tampung = "true";
            }
        }
        if (tampung.equals("false")) {
            System.out.println(kata + " = false");
        } else {
            System.out.println(kata + " = true");
        }
        System.out.print("Apakah ingin mencoba lagi ? (y/t) ");
        jawab=scan.next();

    }while (jawab.equals("y"));
    System.out.println("======Terima Kasih======");
}

}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published