Program palindrome dan pseudopalindrome (kelas 3K)

Program palindrome dan pseudopalindrome bagi kelas 3K

  1. Silahkan menuliskan program palindrome dan pseudopalindrome menggunakan bahasa apapun baik Java, C, C++, Pascal, Basic, dan sebagainya di bagian komentar.
  2. Jangan lupa menuliskan nama dan NIM anda.
  3. Ingat perhatikan baik-baik kelas anda, selain program / koding tuliskan hasilnya dari alur program yang anda tulis.

Perhatian : komentar tidak akan ditampilkan sebelum disetujui.

77 Responses

  1. Nizar Haris Masruri
    09.11.3314

    pak,maaf,baru membuka email kemarin saya tidak tahu kirimnya disini…

    Tugas Pseudopalendrome dan palendrome

    public class pelendrome extends javax.swing.JFrame {
    public pelendrome()
    {
    initComponents();
    }

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
    int a;
    String kata1 = kata.getText();
    String kata2 = “”;

    for (a = 0; a < kata1.length(); a++) {
    kata2 = kata1.substring(a, a + 1) + kata2;

    }
    if (kata1.matches(kata2)) {
    out.setText(kata1 + " = " + kata1 + " adalah Palendrome");
    } else {
    out.setText(kata1 + " = " + kata2 + " adalah Pseudopalendrome");
    }
    }

    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
    kata.setText("");
    out.setText("");
    }

    private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {
    System.exit(0); }

  2. public class ClsPalendrom {
    public static void main(String[] args) {
    int i = 0;
    String tmp1 = “”;
    String tmp2 = “”;

    System.out.println(“Masukan Kata : “);
    tmp1 = System.console().readLine();

    for (i = 0; i < tmp1.length(); i++) {
    tmp2 = tmp1.substring(i, i + 1) + tmp2;
    }

    if (tmp1.matches(tmp2)) {
    System.out.print("Tergolong Pseudopalendrom : ");
    System.out.println(tmp1);
    } else {
    System.out.print("Tergolong Palendrom : ");
    System.out.println(tmp2);
    }
    }
    }

  3. // Nama = Rizky Januardi Satria
    // Kelas = S1.TI-3K
    // NIM = 09.11.3349

    #include
    #include
    #include
    using namespace std;

    int main()
    {
    char word[30];
    int choice;

    cout << "******MENU******\n";
    cout << "1. Palindrome\n";
    cout << "2. Pseudopalindrome\n";
    cout << "3. Keluar\n\n";
    cout <> choice;

    switch(choice)
    {
    case 1 :
    system(“CLS”);
    cout << "\n";
    cout <> word;
    cin.ignore(cin.rdbuf()->in_avail() + 1);

    cout << "Kata Yang Dimasukkan\t = " << word << endl;

    strrev(word);
    cout << "Palindrome\t\t = " << word << endl;
    break;

    case 2 :
    system("CLS");
    cout << "\n";
    cout <in_avail() + 1);
    cout << "Kata Yang Dimasukkan\t = " << word << endl;

    strrev(word);
    cout << "Pseudopalindrome\t = " << word << endl;
    break;

    case 3 :
    break;

    default :
    cout <in_avail() + 1);
    return 0;
    }

  4. public class ClsPalendrom {
    public static void main(String[] args) {
    int i = 0;
    String tmp1 = “”;
    String tmp2 = “”;

    System.out.println(“Masukan Kata : “);
    tmp1 = “katak”;

    for (i = 0; i < tmp1.length(); i++) {
    tmp2 = tmp1.substring(i, i + 1) + tmp2;
    }

    if (tmp1.matches(tmp2)) {
    System.out.print("Tergolong Pseudopalendrom : ");
    System.out.println(tmp1);
    } else {
    System.out.print("Tergolong Palendrom : ");
    System.out.println(tmp2);
    }
    }
    }

  5. Nama : Umi Nur Fadhilah
    NIM : 09.11.3359
    Kelas : S1 TI-3K

    Program menggunakan netbean
    Pseudo Palindrom
    ————————-

    import java.io.*;

    public class Palindrome {
    public static void main(String [] args){
    try{
    BufferedReader object = new BufferedReader(
    new InputStreamReader(System.in));
    System.out.println(“Enter number”);
    int num= Integer.parseInt(object.readLine());
    int n = num;
    int rev=0;
    System.out.println(“Number: “);
    System.out.println(” “+ num);
    for (int i=0; i<=num; i++){
    int r=num%10;
    num=num/10;
    rev=rev*10+r;
    i=0;
    }
    System.out.println("After reversing the number: "+ " ");
    System.out.println(" "+ rev);
    if(n == rev){
    System.out.print("Number is palindrome!");
    }
    else{
    System.out.println("Number is not palindrome!");
    }
    }
    catch(Exception e){
    System.out.println("Out of range!");
    }
    }
    }

  6. /* Nama = ZULFIKAR AJIB
    Kelas = S1TI 3K
    NIM = 09.11.3333
    */

    #include
    #include
    #include
    using namespace std;

    int main()
    {
    char word[30];
    int choice;

    cout << "========MENU PILIHAN========\n";
    cout << "1. Palindrome\n";
    cout << "2. Pseudopalindrome\n";
    cout << "3. Exit\n";
    cout <> choice;

    switch(choice)
    {
    case 1 :
    system(“CLS”);
    cout << "\n";
    cout <> word;
    strrev(word);
    cout << "Palindrome\t = " << word << endl;
    break;

    case 2 :
    system("CLS");
    cout << "\n";
    cout << "Inputan kata\t = ";
    gets(word);

    strrev(word);
    cout << "Pseudopalindrome = " << word << "-" << endl;
    break;

    case 3 :
    break;

    default :
    cout <in_avail() + 1);
    return 0;
    }

    /*OUTPUT:
    Palindrome
    Inputan kata = KAKAK
    Palindrome = KAKAK

    Pseudopalindrome
    Inputan kata = MADAM
    Pseudopalindrome = MADAM-
    */

  7. // Nama = Edy Warnoto
    // Kelas = S1.TI-3K
    // NIM = 09.11.3336

    #include
    #include
    #include
    using namespace std;

    int main()
    {
    char word[30];
    int choice;

    cout << "******MENU******\n";
    cout << "1. Palindrome\n";
    cout << "2. Pseudopalindrome\n";
    cout << "3. Keluar\n\n";
    cout <> choice;

    switch(choice)
    {
    case 1 :
    system(“CLS”);
    cout << "\n";
    cout <> word;
    cin.ignore(cin.rdbuf()->in_avail() + 1);

    cout << "Kata Yang Dimasukkan\t = " << word << endl;

    strrev(word);
    cout << "Palindrome\t\t = " << word << endl;
    break;

    case 2 :
    system("CLS");
    cout << "\n";
    cout <in_avail() + 1);
    cout << "Kata Yang Dimasukkan\t = " << word << endl;

    strrev(word);
    cout << "Pseudopalindrome\t = " << word << endl;
    break;

    case 3 :
    break;

    default :
    cout <in_avail() + 1);
    return 0;
    }

  8. // Nama = Aryo Nugroho
    // Kelas = S1.TI-3K
    // NIM = 09.11.3320

    #include
    #include
    #include
    using namespace std;

    int main()
    {
    char word[30];
    int choice;

    cout << "******MENU******\n";
    cout << "1. Palindrome\n";
    cout << "2. Pseudopalindrome\n";
    cout << "3. Keluar\n\n";
    cout <> choice;

    switch(choice)
    {
    case 1 :
    system(“CLS”);
    cout << "\n";
    cout <> word;
    cin.ignore(cin.rdbuf()->in_avail() + 1);

    cout << "Kata Yang Dimasukkan\t = " << word << endl;

    strrev(word);
    cout << "Palindrome\t\t = " << word << endl;
    break;

    case 2 :
    system("CLS");
    cout << "\n";
    cout <in_avail() + 1);
    cout << "Kata Yang Dimasukkan\t = " << word << endl;

    strrev(word);
    cout << "Pseudopalindrome\t = " << word << endl;
    break;

    case 3 :
    break;

    default :
    cout <in_avail() + 1);
    return 0;
    }

  9. // Nama = Endar Setiyo Pertomo
    // Kelas = S1-TI-3K
    // NIM = 09.11.3376

    #include
    #include
    #include
    using namespace std;

    int main()
    {
    char word[30];
    int choice;

    cout << "========MENU========\n";
    cout << "1. Palindrome\n";
    cout << "2. Pseudopalindrome\n";
    cout << "3. Exit\n\n";
    cout <> choice;

    switch(choice)
    {
    case 1 :
    system(“CLS”);
    cout << "\n";
    cout <> word;
    cin.ignore(cin.rdbuf()->in_avail() + 1);

    cout << "Your Input Word\t = " << word << endl;

    strrev(word);
    cout << "Palindrome\t = " << word << endl;
    break;

    case 2 :
    system("CLS");
    cout << "\n";
    cout <in_avail() + 1);
    cout << "Your Input Word\t = " << word << endl;

    strrev(word);
    cout << "Pseudopalindrome = " << word << endl;
    break;

    case 3 :
    break;

    default :
    cout <in_avail() + 1);
    return 0;
    }

  10. Nama : Maria Magdalena Seuk Tae
    Nim : 09.11.3339
    Kelas : S1TI-3K
    Tugas : Matematika Diskret

    Membuat Pseudopalindrome Dan palindrome dengan Menggunakan program Java.

    1. pseudopalindrome

     INPUTAN:

    package palindrome;

    public class Palindrome {
    public static void main(String[] args) {
    int i = 0;
    String tmp1 = “”;
    String tmp2 = “”;

    System.out.println(“Masukan Kata : “);
    tmp1 = “MADAM”;

    for (i = 0; i < tmp1.length(); i++) {
    tmp2 = tmp1.substring(i, i + 1) + tmp2;
    }

    if (tmp1.matches(tmp2)) {
    System.out.print("Termasuk Pseudopalindrome : ");
    System.out.println(tmp1);
    } else {
    System.out.print("Termasuk Palindrome : ");
    System.out.println(tmp2);
    }
    }
    }

     OUTPUT :

    run:
    Masukan Kata :
    Termasuk Pseudopalindrome : MADAM

    2. Palindrome

     INPUT

    package palindrome;

    public class Palindrome {
    public static void main(String[] args) {
    int i = 0;
    String tmp1 = "";
    String tmp2 = "";

    System.out.println("Masukan Kata : ");
    tmp1 = "AMIKOM";

    for (i = 0; i < tmp1.length(); i++) {
    tmp2 = tmp1.substring(i, i + 1) + tmp2;
    }

    if (tmp1.matches(tmp2)) {
    System.out.print("Termasuk Pseudopalindrome : ");
    System.out.println(tmp1);
    } else {
    System.out.print("Termasuk Palindrome : ");
    System.out.println(tmp2);
    }
    }
    }

     OUTPUT

    run:
    Masukan Kata :
    Termasuk Palindrome : MOKIMA

  11. //Brian Dani Wiradita
    //S1TI-3K
    //09.11.3346

    import java.io.*;

    public class Palendrom {

    public static void main(String[] args) {
    String kata = “”;
    String tmp = “”;
    String tmp2 = “”;
    BufferedReader katamu = new BufferedReader(new InputStreamReader(System.in));
    try {
    System.out.print(“Masukan Kata = “);
    kata = katamu.readLine();
    } catch (IOException ex) {
    ex.printStackTrace();
    }
    for (int i = 0; i < kata.length(); i++) {
    tmp2 = kata.substring(i, i + 1) + tmp2;
    }
    System.out.println("Hasilnya");
    if (kata.matches(tmp2)) {
    System.out.println("Tergolong kata Pseudopalendrome");
    } else {
    System.out.println("Tidak tergolong kata Pseudopalendrome");
    }
    }
    }

  12. Nama :Agus Budi Santoso
    Kelas : S1_TI_3K
    NIM : 09.11.3334

    Program palindrome & pseudopalindrome
    Dengan JAVA

    public class ClsPalendrom {
    public static void main(String[] args) {
    int i = 0;
    String tmp1 = “”;
    String tmp2 = “”;

    System.out.println(“inputkan Kata yang ingin anda identifikasi : “);
    tmp1 = “SIXAT NOON-TAXIS”;

    for (i = 0; i < tmp1.length(); i++) {
    tmp2 = tmp1.substring(i, i + 1) + tmp2;
    }

    if (tmp1.matches(tmp2)) {
    System.out.print("kata yang anda maksud Tergolong Pseudopalendrom : ");
    System.out.println(tmp1);
    } else {
    System.out.print("kata yang anda maksud Tergolong Palendrom : ");
    System.out.println(tmp2);
    }
    }
    }

    HASIL OUTPUT
    inputkan kata yang ingin anda identifikasi :
    kata yang anda maksud Tergolong Pseudopalendrom : SIX AT-NOON TAXIS

  13. Nama : Caslam Junaedi
    Nim : 09.11.3319

    #include
    #include

    void main()

    {
    char mystring[20],compstring[20];
    int length,loop,index=0;

    printf(“Please enter a word under 20 letters to test : “);
    gets(mystring);

    length = strlen(mystring)-1;

    for(loop=length;length>0;length–)
    {
    compstring[index] = mystring[loop];
    index++;
    }

    if(!strcmp(mystring,compstring))
    {
    printf(“The string Is A Palendrome”);
    }
    else
    {
    printf(“The string Is NOT A Palendrome”);
    }

    }

    http://www.4shared.com/photo/ajwtK1Qs/Matematika_Screen_Shoot_2.html

  14. Hendri Riskianto
    09.11.3356

    #include
    #include
    #include

    int main(void)
    {

    char Character[1000];

    char *i = 0;
    char *j = 0;

    int String_Length = 0;

    printf(“Enter a message: “);
    gets(Character);
    printf(“\n”);

    String_Length = strlen(Character);

    for (i = &Character[0]; i <= &Character[String_Length – 1]; i++)
    *i = toupper(*i);

    *i = 0;

    j = &Character[String_Length – 1];

    for (i = &Character[0]; i <= &Character[String_Length – 1]; i++)
    {

    if (*i 90)
    continue;

    if (*j 90)
    j–;

    printf(“%c %c\n”,*i, *j);

    if(*i == *j)

    {
    j–;
    continue;
    }
    else
    printf(“It’s not a palindrome\n”);
    return 0;
    }

    printf(“\nIt’s a palindrome\n”);

    return 0;

    }

    http://www.4shared.com/photo/sqjDxsDF/Matematika_Screen_Shoot_1.html

  15. /**
    * NAMA : CATUR WAHYU KARINA
    * NIM : 09.11.3352
    * KELAS : S1TI-3K
    */
    import java.io.*;
    public class Main
    {
    public static void main(String [] args)
    {
    try
    {
    BufferedReader object = new BufferedReader(new InputStreamReader(System.in));
    System.out.println(“Masukan angka : “);
    int ang= Integer.parseInt(object.readLine());
    int n = ang;
    int rev=0; //rev = reversing ( membalikan objek)
    for (int i=0; i<=ang; i++)
    {
    int r=ang%10;
    ang=ang/10;
    rev=rev*10+r;
    i=0;
    }
    System.out.println("Angka setelah di balik : "+ " ");
    System.out.println(" "+ rev);
    if(n == rev)
    {
    System.out.print(" " + rev + " merupakan palindrome!");
    }
    else
    {
    System.out.println(" " + rev + " merupakan pseudopalindrome!");
    }
    }
    catch(Exception e)
    {
    System.out.println(" oow !");
    }
    }
    }

    /** TAMPILAN SAAT DIJALANKAN
    * Masukan angka :
    * 22
    * Angka setelah di balik :
    * 22
    * 22 merupakan palindrome
    */

  16. #include
    #include
    #include

    int main(void)
    {

    char Character[1000];

    char *i = 0;
    char *j = 0;

    int String_Length = 0;

    printf(“Enter a message: “);
    gets(Character);
    printf(“\n”);

    String_Length = strlen(Character);

    for (i = &Character[0]; i <= &Character[String_Length – 1]; i++)
    *i = toupper(*i);

    *i = 0;

    j = &Character[String_Length – 1];

    for (i = &Character[0]; i <= &Character[String_Length – 1]; i++)
    {

    if (*i 90)
    continue;

    if (*j 90)
    j–;

    printf(“%c %c\n”,*i, *j);

    if(*i == *j)

    {
    j–;
    continue;
    }
    else
    printf(“It’s not a palindrome\n”);
    return 0;
    }

    printf(“\nIt’s a palindrome\n”);

    return 0;

    }

    http://www.4shared.com/photo/sqjDxsDF/Matematika_Screen_Shoot_1.html

  17. #include
    #include
    #include
    #include

    int main()
    {
    char kata[100];
    bool cek;
    cout<<" NAMA : NATANAEL SUNDORO"<<endl;
    cout<<" KELAS : S1-TI-3K"<<endl;
    cout<<" NIM : 09.11.3355"<<endl;
    cout<<"======================================"<<endl;
    cout<<"PROGRAM PALINDROME DAN PSEUDOPALINDROME"<<endl<<endl;
    cout<<"MASUKAN KATA :";
    gets(kata);
    int x=strlen(kata)-1;
    for(int i=0;i<=x;i++)
    {
    if(kata[i]==kata[x-i])
    {
    cek=true;
    continue;
    }
    else
    {
    cek=false;
    break;
    }
    }

    strrev(kata);
    if(cek==true)
    {
    cout<<endl<<"KEBALIKAN:"<<kata<<endl<<endl;
    cout<<"TERMASUK KATA PALINDROME"<<endl;
    }
    else
    {
    cout<<endl<<"KEBALIKAN:"<<kata<<endl<<endl;
    cout<<"TERMASUK KATA PSEUDOPALINDROME"<<endl;
    }
    getch();
    }

  18. // Nama = Dikky Faiz Maulana
    // Kelas = S1-TI-3K
    // NIM = 09.11.3374

    #include
    #include
    #include

    using namespace std;

    int main()
    {
    char word[30];
    int choice;

    cout << "========MENU========\n";
    cout << "[1] Palindrome\n";
    cout << "[2] Pseudopalindrome\n";
    cout << "[3] Exit\n";
    cout <> choice;

    switch(choice)
    {
    case 1 :
    system(“CLS”);
    cout << "\n";
    cout <> word;

    cout << "A\t\t = " << word << endl;

    strrev(word);
    cout << "Palindrome\t = " << word << endl;
    break;

    case 2 :
    system("CLS");
    cout << "\n";
    cout << "Input word\t = ";
    gets(word);

    cout << "A\t\t = " << word << endl;

    strrev(word);
    cout << "Pseudopalindrome = " << word << endl;
    break;

    case 3 :
    break;

    default :
    cout <in_avail() + 1);
    return 0;
    }

    /*
    * setelah di run muncul 3 pilihan yaitu dan harus di inputkan sesuai perintah yaitu
    * 1 untuk palindrome
    * 2 untuk pseudopalindrome
    * 3 untuk keluar
    * jika menginputkan angka 1 muncul perintah untuk memasukan string dan ketikan misal “madam” (tanpa tanda petik) maka akan di proses dan di di tampilkan output yaitu “madam” (tanpa tanda petik)
    * jika menginputkan angka 2 muncul perintah untuk memasukan string dan ketikan misal “madam i’m adam” (tanpa tanda petik) maka akan di proses dan di di tampilkan output yaitu “mada m’i madam” (tanpa tanda petik)
    * jika menginputkan angka 3 maka akan keluar dari program
    * jika menginputkan angka selain 1,2, dan 3 maka akan muncul output “You made an illegal choice.” dan program otomatis akan keluar
    */

  19. NAMA : MULYADI
    NIM : 09.11.3332
    KELAS: S1 TI 3K

    #include
    #include

    main()
    {
    int jmlh, i, j, k;
    char kata[10];
    cout<>jmlh;
    cout<<"Masukkan kata = ";

    for (i=0;i>kata[i];}

    cout<=0;j–)
    {cout<<kata[j];}

    cout<=0;k–)
    {
    kata[jmlh-1]=’-‘;
    cout<<kata[k];
    }

    getch();
    }

  20. NAMA : Rizky
    NIM : 09.11.3378
    KELAS: S1 TI 3K

    #include
    #include

    main()
    {
    int jmlh, i, j, k;
    char kata[10];
    cout<>jmlh;
    cout<<"Masukkan kata = ";

    for (i=0;i>kata[i];}

    cout<=0;j–)
    {cout<<kata[j];}

    cout<=0;k–)
    {
    kata[jmlh-1]=’-‘;
    cout<<kata[k];
    }

    getch();
    }

  21. /* —————————————-*/
    /* —- PALINDROM DAN PSEUDOPALINDROM—-*/
    /* By HERDY FEBRI HANDOKO */
    /* 09.11.3365 */
    /* S1-TI-3K */
    /* —————————————-*/

    #include
    #include

    #define MAX 75
    #define true 1
    #define false 0

    char stack[MAX];
    int top;

    void init(void);
    int full(void);
    int empty(void);
    char pop(void);
    void clear(void);
    void push(char info);

    main()
    {
    char pilih;
    char kal[75];
    int k,p;

    printf(“– Membalik Kata Dengan Stack –\n”);
    init();

    do
    {
    printf(“MENU PILIHAN :\n”);
    printf(“[1] Masukkan kata\n”);
    printf(“[2] Palindrom\n”);
    printf(“[3] Pseudopalindrom\n”);
    printf(“[4] Selesai\n”);
    printf(” Pilihan :”);
    scanf(“%s”,&pilih);
    switch(pilih)
    {

    case’1′ :
    printf(“Masukkan kata:”);
    scanf(“%s”,&kal);
    p=strlen(kal);
    for(k=0;k<=p;k++)
    push(kal[k]);
    printf("kata yang masuk:");
    for(k=1;k=1;k–)
    printf(“%c”,pop());
    printf(“\n”);
    }
    else printf(“Stack kosong\n”);
    break;
    case’3′ :
    if(empty()!=true)
    {
    printf(“Pseudopalindrom anda adalah :”);
    for(k=top;k>=1;k–)
    printf(“%c”,pop());
    printf(“\n”);
    }
    else printf(“Stack kosong\n”);
    break;
    case’4′ :
    break;
    default : printf(“Salah pilih .. \n”);
    }
    printf(“\n”);
    }
    while(pilih!=’4′);
    }

    void init(void)
    {
    top=0;
    }

    void push(char info)
    {
    if (full()!=true)
    {
    top++;
    stack[top]=info;
    }
    else
    printf(“Stack overflow .. \n”);
    }

    char pop(void)
    {
    char info;

    if (empty()!=true)
    {
    info=stack[top];
    top–;
    return(info);
    }

    else
    printf(“Stack underflow .. \n”);
    }

    int full(void)
    {
    if(top==MAX)
    return(true);
    else
    return(false);
    }

    int empty(void)
    {
    if(top==0)
    return(true);
    else
    return(false);
    }

  22. // frezy dwi hariyanto
    // 09.11.3321
    // S1.Ti.3K

    public class ClsPalendrom {
    public static void main(String[] args) {
    int i = 0;
    String tmp1 = “”;
    String tmp2 = “”;

    System.out.println(“Masukan Sebuah Kata : “);
    tmp1 = “kakak”;

    for (i = 0; i < tmp1.length(); i++) {
    tmp2 = tmp1.substring(i, i + 1) + tmp2;
    }

    if (tmp1.matches(tmp2)) {
    System.out.print("Termasuk Pseudopalendrom : ");
    System.out.println(tmp1);
    } else {
    System.out.print("Termasuk Palendrom : ");
    System.out.println(tmp2);
    }
    }
    }

  23. NAMA : EDY HARYANTO
    NIM : 09.11.3317
    KELAS: S1 TI 3K

    #include
    #include

    main()
    {
    int jmlh, i, j, k;
    char kata[10];
    cout<>jmlh;
    cout<<"MASUKAN KATA YANG INGIN DIPROSES = ";

    for (i=0;i>kata[i];}

    cout<=0;j–)
    {cout<<kata[j];}

    cout<=0;k–)
    {
    kata[jmlh-1]=’-‘;
    cout<<kata[k];
    }

    getch();
    }

    half.bloodprinceses@gmail.com

  24. NAMA : DENI UMAR DANI
    NIM : 09.11.3340
    KELAS: S1 TI 3K

    #include
    #include

    main()
    {
    int jmlh, i, j, k;
    char kata[10];
    cout<>jmlh;
    cout<<"MASUKAN KATA YANG INGIN DIPROSES = ";

    for (i=0;i>kata[i];}

    cout<=0;j–)
    {cout<<kata[j];}

    cout<=0;k–)
    {
    kata[jmlh-1]=’-‘;
    cout<<kata[k];
    }

    getch();
    }

  25. NAMA : EDY HARYANTO
    NIM : 09.11.3317
    KELAS: S1 TI 3K

    #include
    #include

    main()
    {
    int jmlh, i, j, k;
    char kata[10];
    cout<>jmlh;
    cout<<"MASUKAN KATA YANG INGIN DIPROSES = ";

    for (i=0;i>kata[i];}

    cout<=0;j–)
    {cout<<kata[j];}

    cout<=0;k–)
    {
    kata[jmlh-1]=’-‘;
    cout<<kata[k];
    }

    getch();
    }

  26. // Nama = Hendro Adi Cahyo
    // Kelas = S1-TI-3K
    // NIM = 09.11.3328

    #include
    #include
    #include
    using namespace std;

    int main()
    {
    char word[30];
    int choice;

    cout << "========MENU========\n";
    cout << "1. Palindrome\n";
    cout << "2. Pseudopalindrome\n";
    cout << "3. Exit\n";
    cout <> choice;

    switch(choice)
    {
    case 1 :

    system(“CLS”);
    cout << "\n";

    cout <> word;
    cout << "A\t\t = " << word << endl;

    strrev(word);
    cout << "Palindrome\t = " << word << endl;

    break;

    case 2 :
    system("CLS");
    cout << "\n";
    cout << "Input word\t = ";

    gets(word);

    cout << "A\t\t = " << word << endl;

    strrev(word);
    cout << "Pseudopalindrome = " << word << endl;
    break;

    case 3 :
    break;

    default :
    cout <in_avail() + 1);
    return 0;
    }

    // hasil nya
    // ========MENU========
    // 1. Palindrome
    // 2. Pseudopalindrome
    // 3. Exit

  27. /* Nama = WAWAN ALIF MUSTOFA
    Kelas = S1-TI-3K
    NIM = 09.11.3375
    */
    #include
    #include
    #include
    using namespace std;

    int main()
    {
    char word[30];
    int choice;

    cout << "========MENU OPTIONS========\n";
    cout << "1. Palindrome\n";
    cout << "2. Pseudopalindrome\n";
    cout << "3. Exit\n";
    cout <> choice;

    switch(choice)
    {
    case 1 :
    system(“CLS”);
    cout << "\n";
    cout <> word;

    cout << "word\t\t = " << word << endl;

    strrev(word);
    cout << "Palindrome\t = " << word << endl;
    break;

    case 2 :
    system("CLS");
    cout << "\n";
    cout << "Input word\t = ";
    gets(word);
    cout << "word\t\t = " << word << endl;

    strrev(word);
    cout << "Pseudopalindrome = " << word << endl;
    break;

    case 3 :
    break;

    default :
    cout <in_avail() + 1);
    return 0;
    }

    OUTPUT:
    Palindrome
    input word = ada
    word = ada
    palindrome = ada

    pseudopalindrome
    input word = madam i’m adam
    word = madam i’m adam
    pseudopalindrome = mada m’i madam

  28. /* Nama = GANANG ARIS SUTIGNO
    Kelas = S1-TI-3K
    NIM = 09.11.3368
    */
    #include
    #include
    #include
    using namespace std;

    int main()
    {
    char word[30];
    int choice;

    cout << "========MENU PILIHAN========\n";
    cout << "1. Palindrome\n";
    cout << "2. Pseudopalindrome\n";
    cout << "3. Exit\n";
    cout <> choice;

    switch(choice)
    {
    case 1 :
    system(“CLS”);
    cout << "\n";
    cout <> word;
    cout << "word\t\t = " << word << endl;

    strrev(word);
    cout << "Palindrome\t = " << word << endl;
    break;

    case 2 :
    system("CLS");
    cout << "\n";
    cout << "Input word\t = ";
    gets(word);
    cout << "word\t\t = " << word << endl;

    strrev(word);
    cout << "Pseudopalindrome = " << word << endl;
    break;

    case 3 :
    break;

    default :
    cout <in_avail() + 1);
    return 0;
    }

    OUTPUT:
    Palindrome
    input word = 2002
    word = 2002
    palindrome = 2002

    pseudopalindrome
    input word = madam i’m adam
    word = madam i’m adam
    pseudopalindrome = mada m’i madam

  29. // nama : Krisna Bayu Aji
    // NIM : 09.11.3313

    #include
    #include
    main()
    {
    int jmlh, i, j, k, l;
    char kata[10];
    cout<<"*********PROGRAM PALINDROME DAN PSEUDO PALINDROME*********\n";
    cout<>jmlh;
    cout<<"Masukkan kata = ";
    for (i=0;i>kata[i];}
    cout<=0;j–)
    {cout<<kata[j];}

    cout<<"\nPseudo Palendrom = ";
    for (k=0;k<jmlh;k++)
    {
    cout<<kata[k];
    }
    cout<=0;l–)
    {
    cout<<kata[l];
    }
    getch();
    }

    TAMPILAN :

    *********PROGRAM PALINDROME DAN PSEUDO PALINDROME*********

    Tentukan jumlah huruf = 5
    Masukkan kata = kasur
    Palindrome = rusak
    Pseudo Palendrome = kasur rusak

  30. //nim : 09.11.3312

    import java.io.BufferedReader;
    import java.io.IOException;
    import java.io.InputStreamReader;

    public class ClsPalendrom {
    public static void main(String[] args) {
    int i = 0;
    String tmp1 = “”;
    String tmp2 = “”;

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

    System.out.println(“Masukan Kata : “);
    try {
    tmp1 = BacaText.readLine();
    } catch(IOException ex) {
    ex.printStackTrace();
    }

    for (i = 0; i < tmp1.length(); i++) {
    tmp2 = tmp1.substring(i, i + 1) + tmp2;
    }

    if (tmp1.matches(tmp2)) {
    System.out.print("Tergolong Pseudopalendrom : ");
    System.out.println(tmp1);
    } else {
    System.out.print("Tergolong Palendrom : ");
    System.out.println(tmp2);
    }
    }
    }

  31. //NIM: 09.11.3382

    import java.io.BufferedReader;
    import java.io.IOException;
    import java.io.InputStreamReader;

    public class ClsPalendrom {
    public static void main(String[] args) {
    int i = 0;
    String tmp1 = “”;
    String tmp2 = “”;

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

    System.out.println(“Masukan Kata : “);
    try {
    tmp1 = BacaText.readLine();
    } catch(IOException ex) {
    ex.printStackTrace();
    }

    for (i = 0; i < tmp1.length(); i++) {
    tmp2 = tmp1.substring(i, i + 1) + tmp2;
    }

    if (tmp1.matches(tmp2)) {
    System.out.print("Tergolong Pseudopalendrom : ");
    System.out.println(tmp1);
    } else {
    System.out.print("Tergolong Palendrom : ");
    System.out.println(tmp2);
    }
    }
    }

  32. //nama: Bagus Setyo Kuriniawan
    //nim : 09.11.3315
    // kelas: S1 TI 3K

    #include
    #include
    void main()
    {
    int first,last,flag=1;
    char str[100];
    clrscr();
    printf(“masukkan kata : “);
    gets(str);
    first=0;
    last=strlen(str)-1;

    printf(“%d”,first);
    printf(“%d”,last);
    while(first<=last)
    {
    if(str[first]!=str[last])
    flag=0;
    first++;
    last–;
    }
    if(flag==1)
    {
    clrscr();
    printf("termasuk kategori palindrome");
    getch();
    }
    else
    {
    clrscr();
    printf("bukan termasuk kategori palindrome");
    getch();
    }
    }

  33. // Faisal Reza Pradhana
    // S1-TI-3K
    // 09.11.3325
    // Math.Diskret
    //menthor : Mr.Ferry Wahyu Wibowo,MSC

    #include
    #include
    #include
    using namespace std;

    int main()
    {
    char word[40];
    int Pilihan;

    cout << "========Menu========\n";
    cout << "1. Palindrome\n";
    cout << "2. Pseudopalindrome\n";
    cout << "3. keluar\n";
    cout <> Pilihan;

    switch(Pilihan)
    {
    case 1 :
    system(“CLS”);
    cout << "\n";
    cout <> word;

    cout << "A\t\t = " << word << endl;

    strrev(word);
    cout << "Palindrome\t = " << word << endl;
    break;

    case 2 :
    system("CLS");
    cout << "\n";
    cout << "Input word\t = ";
    gets(word);

    cout << "A\t\t = " << word << endl;

    strrev(word);
    cout << "Pseudopalindrome = " << word << endl;
    break;

    case 3 :
    break;

    default :
    cout <in_avail() + 1);
    return 0;
    }

    /*maaf pak borland saya sedang korupt jadi tidak bisa mengompile langsung,tapi secara manual keluaranya seperti berikut

    Menu
    1.palindrome
    2.pseudopalindrome
    3.keluar

    jika dipilih 1 maka:
    insert word:
    misal “katak” = katak

    jika dipilih 2
    insert word:
    misal “kasur rusak”= kasur rusak.

    demikian terimakasih*/

  34. import java.io.*;

    public class Palendrom {

    public static void main(String[] args) {
    String kata = “”;
    String tmp = “”;
    String tmp2 = “”;
    BufferedReader katamu = new BufferedReader(new InputStreamReader(System.in));
    try {
    System.out.print(“Masukan Kata = “);
    kata = katamu.readLine();
    } catch (IOException ex) {
    ex.printStackTrace();
    }
    for (int i = 0; i < kata.length(); i++) {
    tmp2 = kata.substring(i, i + 1) + tmp2;
    }
    System.out.println("Hasilnya");
    if (kata.matches(tmp2)) {
    System.out.println("Tergolong kata Pseudopalendrome");
    } else {
    System.out.println("Tidak tergolong kata Pseudopalendrome");
    }
    }
    }

    Heru Fajar N
    09.11.3384 / S1.TI.3K

  35. //Muhammad Lukman Nul Hakim
    //09.11.3318
    //S1 TI 3K

    import java.io.BufferedReader;
    import java.io.IOException;
    import java.io.InputStreamReader;

    public class ClsPalendrom {
    public static void main(String[] args) {
    int i = 0;
    String in1 = “”;
    String in2 = “”;

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

    System.out.print(“Inputkan Kata : “);
    try {
    in1 = input.readLine();
    } catch(IOException ex) {
    ex.printStackTrace();
    }

    for (i = 0; i < in1.length(); i++) {
    in2 = in1.substring(i, i + 1) + in2;
    }

    if (in1.matches(in2)) {
    System.out.print("Tergolong Pseudopalendrom : ");
    System.out.println(in1);
    } else {
    System.out.print("Tergolong Palendrom : ");
    System.out.println(in2);
    }
    }
    }

  36. //Nama : Amalia Khasanah
    //Nim : 09.11.3372
    //Kelas : S1TI3K

    #include
    #include
    #include
    void main()
    {
    clrscr();
    char kata[20],kiti[20];
    int n,m,o,a;
    printf(“PROGRAM PENDETEKSI PALINDROM”);
    printf(“\nMasukkan Kata/kalimat: “);
    gets(kata);
    n=0;
    do
    {
    n++;
    }
    while(kata[n]!=”);
    n–;
    for(m=0;m<=n;m++)
    {
    kiti[m]=kata[n-m];
    }
    o=0;
    do
    {
    if(kata[o]!=kiti[o])
    {
    printf("kata/kalimat yang anda masukkan bukan PALINDROM");
    getch();
    exit(1);
    }
    o++;
    }
    while(kata[o]!='');
    printf("kata/kalimat yang anda masukkan PALINDROM");
    getch();
    }

    #include
    #include
    #include

    int main(){
    char a[100];
    int b,i;
    printf (“PROGRAM PSEUDO PALINDROM”);
    printf (“\n========================”);
    printf(“\nMasukkan Kata : “);
    gets(a);

    b= strlen(a);
    printf(“\ndibalik : “);
    for(i=b; i>=0; i–){
    printf(“%c”, a[i]);
    }
    getch();
    }

  37. NAMA : BIL MUAMMAR
    NIM : 09.11.3371
    KELAS :S1 TI 3K

    PROGRAM PALINDROME DAN PSEUDOPALINDROME

    ++++++++++++++
    ++ JAVA +++++

    public class ClsPalendrom {
    public static void main(String[] args) {
    int i = 0;
    String tmp1 = “”;
    String tmp2 = “”;

    System.out.println(“Masukan Kata : “);
    tmp1 = “katak”;

    for (i = 0; i < tmp1.length(); i++) {
    tmp2 = tmp1.substring(i, i + 1) + tmp2;
    }

    if (tmp1.matches(tmp2)) {
    System.out.print("Tergolong Pseudopalendrom : ");
    System.out.println(tmp1);
    } else {
    System.out.print("Tergolong Palendrom : ");
    System.out.println(tmp2);
    }
    }
    }

    • NAMA : BIL MUAMMAR
      NIM : 09.11.3371
      KELAS :S1 TI 3K

      PROGRAM PALINDROME DAN PSEUDOPALINDROME

      ++++++++++++++
      ++ JAVA +++++

      public class ClsPalendrom {
      public static void main(String[] args) {
      int i = 0;
      String tmp1 = “”;
      String tmp2 = “”;

      System.out.println(“Masukan Kata : “);
      tmp1 = “katak”;

      for (i = 0; i < tmp1.length(); i++) {
      tmp2 = tmp1.substring(i, i + 1) + tmp2;
      }

      if (tmp1.matches(tmp2)) {
      System.out.print("Tergolong Pseudopalendrom : ");
      System.out.println(tmp1);
      } else {
      System.out.print("Tergolong Palendrom : ");
      System.out.println(tmp2);
      }
      }
      }

  38. //yulisetyawan
    //09.11.3322
    //s1ti 3k
    int main(int argc, char* argv[])
    {
    AnsiString Line;
    int Front;
    int Back ;
    bool Palindrome(char *, int, int);
    //Pseudo-Code
    WriteString(“Enter the string to be tested”);
    Line = ReadStringPr(“Enter the string to be tested”);
    Front = 1;
    Back = Length(Line);
    Palindrome = true;
    while ((Front < Back) & (Palindrome = true));
    {
    if (Line[Front] == Line[Back])
    {
    Palindrome = false;
    }
    else
    {
    Front = Front + 1;
    Back = Back – 1;
    } //ifend
    } //loopend
    WriteString("Line");
    if (Palindrome = true)
    {
    WriteString("is a palindrome");
    }
    else
    {
    WriteString("is not a palindrome");
    }
    getchar();
    return 0;
    }

  39. NAMA : Bhahtiar Kurniawan
    KELAS : S1-TI-3K
    NIM : 09.11.3324

    Tugas Program palindrome dan pseudopalindrome (kelas 3K)

    import java.io.BufferedReader;
    import java.io.IOException;
    import java.io.InputStreamReader;

    public class ClsPalendrome {
    public static void main(String[] args) {
    int i = 0;
    String tmp1 = “”;
    String tmp2 = “”;

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

    System.out.println(“Masukkan kata : “);
    try {
    tmp1 = BacaText.readLine();
    } catch(IOException ex) {
    ex.printStackTrace();
    }

    for (i = 0; i < tmp1.length(); i++) {
    tmp2 = tmp1.substring(i, i + 1) + tmp2;
    }

    if (tmp1.matches(tmp2)) {
    System.out.print("Kategori Pseudopalendrom : ");
    System.out.println(tmp1);
    } else {
    System.out.print("Kateogri Palendrom : ");
    System.out.println(tmp2);
    }
    }
    }

  40. //edwin prastyo s1-TI-3k 09.11.3345

    import java.io.BufferedReader;
    import java.io.IOException;
    import java.io.InputStreamReader;

    public class ClsPalendrom {
    public static void main(String[] args) {
    int i = 0;
    String tmp1 = “”;
    String tmp2 = “”;

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

    System.out.println(“Masukan Kata : “);
    try {
    tmp1 = BacaText.readLine();
    } catch(IOException ex) {
    ex.printStackTrace();
    }

    for (i = 0; i < tmp1.length(); i++) {
    tmp2 = tmp1.substring(i, i + 1) + tmp2;
    }

    if (tmp1.matches(tmp2)) {
    System.out.print("Tergolong Pseudopalendrom : ");
    System.out.println(tmp1);
    } else {
    System.out.print("Tergolong Palendrom : ");
    System.out.println(tmp2);
    }
    }
    }

  41. NAMA : Aris Syaifudin
    KELAS : S1-TI-3K
    NIM : 09.11.3351

    Tugas Program palindrome dan pseudopalindrome (kelas 3K)

    import java.io.BufferedReader;
    import java.io.IOException;
    import java.io.InputStreamReader;

    public class ClsPalendrome {
    public static void main(String[] args) {
    int i = 0;
    String tmp1 = “”;
    String tmp2 = “”;

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

    System.out.println(“Tuliskan kata : “);
    try {
    tmp1 = BacaText.readLine();
    } catch(IOException ex) {
    ex.printStackTrace();
    }

    for (i = 0; i < tmp1.length(); i++) {
    tmp2 = tmp1.substring(i, i + 1) + tmp2;
    }

    if (tmp1.matches(tmp2)) {
    System.out.print("Tergolong Pseudopalendrom : ");
    System.out.println(tmp1);
    } else {
    System.out.print("Tergolong Palendrom : ");
    System.out.println(tmp2);
    }
    }
    }

  42. NAMA : ALFIANTO
    KELAS : S1-TI-3K
    NIM : 09.11.3377
    Tugas Program palindrome dan pseudopalindrome (kelas 3K)

    import java.io.BufferedReader;
    import java.io.IOException;
    import java.io.InputStreamReader;

    public class ClsPalendrome {
    public static void main(String[] args) {
    int i = 0;
    String tmp1 = “”;
    String tmp2 = “”;

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

    System.out.println(“Ketikan Kata yang anada inginkan : “);
    try {
    tmp1 = BacaText.readLine();
    } catch(IOException ex) {
    ex.printStackTrace();
    }

    for (i = 0; i < tmp1.length(); i++) {
    tmp2 = tmp1.substring(i, i + 1) + tmp2;
    }

    if (tmp1.matches(tmp2)) {
    System.out.print("Tergolong Pseudopalendrom : ");
    System.out.println(tmp1);
    } else {
    System.out.print("Tergolong Palendrom : ");
    System.out.println(tmp2);
    }
    }
    }

  43. Nama : Shodiq W

  44. /*
    * Nama : Hari Muryanto
    * NIM : 09.11.3341
    * Kelas : S1TI-3K
    */

    package Matematika_diskret;

    import java.io.BufferedReader;
    import java.io.BufferedInputStream;
    import java.io.IOException;
    import java.io.InputStreamReader;

    public class ClsPalindrome_Pseudopalindrome {

    public static void main(String[] args) {
    String kata = “”;
    String hasil = “”;
    String hasil2 = “”;
    BufferedReader Alphabets = new BufferedReader(new InputStreamReader(System.in));
    try {
    System.out.print(“Masukan Sebuah Kata = “);
    kata = Alphabets.readLine();
    } catch (IOException ex) {
    ex.printStackTrace();
    }

    int PanjangString = kata.length();
    int batas = PanjangString;
    for (int i = 0; i < PanjangString; i++) {
    hasil += kata.substring(batas – 1, batas);
    batas–;
    }

    for (int i = 0; i Palindrome (balik kata)= ” + hasil);

    if (kata.matches(hasil2)) {
    System.out.println(“-> ” + kata + ” = ” + “Termasuk kata Pseudopalindrome”);

    } else {
    System.out.println(“-> ” + kata + ” = ” + “Tidak termasuk kata Pseudopalindrome”);

    }
    }
    }

    Output Program :

    Masukan Sebuah Kata = sugus
    Hasil Analisa
    -> Palindrome (balik kata)= sugus
    -> sugus = Termasuk kata Pseudopalindrome

  45. //java crips

    import java.io.BufferedReader;
    import java.io.IOException;
    import java.io.InputStreamReader;

    public class ClsPalendrom {
    public static void main(String[] args) {
    int i = 0;
    String tmp1 = “”;
    String tmp2 = “”;

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

    System.out.println(“Masukan Kata : “);
    try {
    tmp1 = BacaText.readLine();
    } catch(IOException ex) {
    ex.printStackTrace();
    }

    for (i = 0; i < tmp1.length(); i++) {
    tmp2 = tmp1.substring(i, i + 1) + tmp2;
    }

    if (tmp1.matches(tmp2)) {
    System.out.print("Tergolong Pseudopalendrom : ");
    System.out.println(tmp1);
    } else {
    System.out.print("Tergolong Palendrom : ");
    System.out.println(tmp2);
    }
    }
    }

  46. /* —————————————-*/
    /* —- Palindrom dan Pseudopalindrom —-*/
    /* By TWIKE ADIGA JOGJANINGRUM */
    /* —————————————-*/

    #include
    #include

    #define MAX 75
    #define true 1
    #define false 0

    char stack[MAX];
    int top;

    void init(void);
    int full(void);
    int empty(void);
    char pop(void);
    void clear(void);
    void push(char info);

    main()
    {
    char pilih;
    char kal[75];
    int k,p;

    printf(“– Membalik Kata Dengan Stack –\n”);
    init();

    do
    {
    printf(“MENU PILIHAN :\n”);
    printf(“[1] Masukkan kata\n”);
    printf(“[2] Palindrom\n”);
    printf(“[3] Pseudopalindrom\n”);
    printf(“[4] Selesai\n”);
    printf(” Pilihan :”);
    scanf(“%s”,&pilih);
    switch(pilih)
    {

    case’1′ :
    printf(“Masukkan kata:”);
    scanf(“%s”,&kal);
    p=strlen(kal);
    for(k=0;k<=p;k++)
    push(kal[k]);
    printf("kata yang masuk:");
    for(k=1;k=1;k–)
    printf(“%c”,pop());
    printf(“\n”);
    }
    else printf(“Stack kosong\n”);
    break;
    case’3′ :
    if(empty()!=true)
    {
    printf(“Pseudopalindrom anda adalah :”);
    for(k=top;k>=1;k–)
    printf(“%c”,pop());
    printf(“\n”);
    }
    else printf(“Stack kosong\n”);
    break;
    case’4′ :
    break;
    default : printf(“Salah pilih .. \n”);
    }
    printf(“\n”);
    }
    while(pilih!=’4′);
    }

    void init(void)
    {
    top=0;
    }

    void push(char info)
    {
    if (full()!=true)
    {
    top++;
    stack[top]=info;
    }
    else
    printf(“Stack overflow .. \n”);
    }

    char pop(void)
    {
    char info;

    if (empty()!=true)
    {
    info=stack[top];
    top–;
    return(info);
    }

    else
    printf(“Stack underflow .. \n”);
    }

    int full(void)
    {
    if(top==MAX)
    return(true);
    else
    return(false);
    }

    int empty(void)
    {
    if(top==0)
    return(true);
    else
    return(false);
    }

  47. /* —————————————-*/
    /* —- Palindrom dan Pseudopalindrom —-*/
    /* By RICKY ADITYA */
    /* —————————————-*/

    #include
    #include

    #define MAX 75
    #define true 1
    #define false 0

    char stack[MAX];
    int top;

    void init(void);
    int full(void);
    int empty(void);
    char pop(void);
    void clear(void);
    void push(char info);

    main()
    {
    char pilih;
    char kal[75];
    int k,p;

    printf(“– Membalik Kata Dengan Stack –\n”);
    init();

    do
    {
    printf(“MENU PILIHAN :\n”);
    printf(“[1] Masukkan kata\n”);
    printf(“[2] Palindrom\n”);
    printf(“[3] Pseudopalindrom\n”);
    printf(“[4] Selesai\n”);
    printf(” Pilihan :”);
    scanf(“%s”,&pilih);
    switch(pilih)
    {

    case’1′ :
    printf(“Masukkan kata:”);
    scanf(“%s”,&kal);
    p=strlen(kal);
    for(k=0;k<=p;k++)
    push(kal[k]);
    printf("kata yang masuk:");
    for(k=1;k=1;k–)
    printf(“%c”,pop());
    printf(“\n”);
    }
    else printf(“Stack kosong\n”);
    break;
    case’3′ :
    if(empty()!=true)
    {
    printf(“Pseudopalindrom anda adalah :”);
    for(k=top;k>=1;k–)
    printf(“%c”,pop());
    printf(“\n”);
    }
    else printf(“Stack kosong\n”);
    break;
    case’4′ :
    break;
    default : printf(“Salah pilih .. \n”);
    }
    printf(“\n”);
    }
    while(pilih!=’4′);
    }

    void init(void)
    {
    top=0;
    }

    void push(char info)
    {
    if (full()!=true)
    {
    top++;
    stack[top]=info;
    }
    else
    printf(“Stack overflow .. \n”);
    }

    char pop(void)
    {
    char info;

    if (empty()!=true)
    {
    info=stack[top];
    top–;
    return(info);
    }

    else
    printf(“Stack underflow .. \n”);
    }

    int full(void)
    {
    if(top==MAX)
    return(true);
    else
    return(false);
    }

    int empty(void)
    {
    if(top==0)
    return(true);
    else
    return(false);
    }

    /* —————————————-*/
    /* —- Palindrom dan Pseudopalindrom —-*/
    /* By RICKY ADITYA */
    /* —————————————-*/

    #include
    #include

    #define MAX 75
    #define true 1
    #define false 0

    char stack[MAX];
    int top;

    void init(void);
    int full(void);
    int empty(void);
    char pop(void);
    void clear(void);
    void push(char info);

    main()
    {
    char pilih;
    char kal[75];
    int k,p;

    printf(“– Membalik Kata Dengan Stack –\n”);
    init();

    do
    {
    printf(“MENU PILIHAN :\n”);
    printf(“[1] Masukkan kata\n”);
    printf(“[2] Palindrom\n”);
    printf(“[3] Pseudopalindrom\n”);
    printf(“[4] Selesai\n”);
    printf(” Pilihan :”);
    scanf(“%s”,&pilih);
    switch(pilih)
    {

    case’1′ :
    printf(“Masukkan kata:”);
    scanf(“%s”,&kal);
    p=strlen(kal);
    for(k=0;k<=p;k++)
    push(kal[k]);
    printf("kata yang masuk:");
    for(k=1;k=1;k–)
    printf(“%c”,pop());
    printf(“\n”);
    }
    else printf(“Stack kosong\n”);
    break;
    case’3′ :
    if(empty()!=true)
    {
    printf(“Pseudopalindrom anda adalah :”);
    for(k=top;k>=1;k–)
    printf(“%c”,pop());
    printf(“\n”);
    }
    else printf(“Stack kosong\n”);
    break;
    case’4′ :
    break;
    default : printf(“Salah pilih .. \n”);
    }
    printf(“\n”);
    }
    while(pilih!=’4′);
    }

    void init(void)
    {
    top=0;
    }

    void push(char info)
    {
    if (full()!=true)
    {
    top++;
    stack[top]=info;
    }
    else
    printf(“Stack overflow .. \n”);
    }

    char pop(void)
    {
    char info;

    if (empty()!=true)
    {
    info=stack[top];
    top–;
    return(info);
    }

    else
    printf(“Stack underflow .. \n”);
    }

    int full(void)
    {
    if(top==MAX)
    return(true);
    else
    return(false);
    }

    int empty(void)
    {
    if(top==0)
    return(true);
    else
    return(false);
    }

  48. /* —————————————-*/
    /* —- Palindrom dan Pseudopalindrom —-*/
    /* By RICKY ADITYA */
    /* —————————————-*/

    #include
    #include

    #define MAX 75
    #define true 1
    #define false 0

    char stack[MAX];
    int top;

    void init(void);
    int full(void);
    int empty(void);
    char pop(void);
    void clear(void);
    void push(char info);

    main()
    {
    char pilih;
    char kal[75];
    int k,p;

    printf(“– Membalik Kata Dengan Stack –\n”);
    init();

    do
    {
    printf(“MENU PILIHAN :\n”);
    printf(“[1] Masukkan kata\n”);
    printf(“[2] Palindrom\n”);
    printf(“[3] Pseudopalindrom\n”);
    printf(“[4] Selesai\n”);
    printf(” Pilihan :”);
    scanf(“%s”,&pilih);
    switch(pilih)
    {

    case’1′ :
    printf(“Masukkan kata:”);
    scanf(“%s”,&kal);
    p=strlen(kal);
    for(k=0;k<=p;k++)
    push(kal[k]);
    printf("kata yang masuk:");
    for(k=1;k=1;k–)
    printf(“%c”,pop());
    printf(“\n”);
    }
    else printf(“Stack kosong\n”);
    break;
    case’3′ :
    if(empty()!=true)
    {
    printf(“Pseudopalindrom anda adalah :”);
    for(k=top;k>=1;k–)
    printf(“%c”,pop());
    printf(“\n”);
    }
    else printf(“Stack kosong\n”);
    break;
    case’4′ :
    break;
    default : printf(“Salah pilih .. \n”);
    }
    printf(“\n”);
    }
    while(pilih!=’4′);
    }

    void init(void)
    {
    top=0;
    }

    void push(char info)
    {
    if (full()!=true)
    {
    top++;
    stack[top]=info;
    }
    else
    printf(“Stack overflow .. \n”);
    }

    char pop(void)
    {
    char info;

    if (empty()!=true)
    {
    info=stack[top];
    top–;
    return(info);
    }

    else
    printf(“Stack underflow .. \n”);
    }

    int full(void)
    {
    if(top==MAX)
    return(true);
    else
    return(false);
    }

    int empty(void)
    {
    if(top==0)
    return(true);
    else
    return(false);
    }

  49. /* —————————————-*/
    /* —- PALINDROM DAN PSEUDOPALINDROM—-*/
    /* By FITRI LESTARI */
    /* 09.11.3329 */
    /* S1-TI-3K */
    /* —————————————-*/

    #include
    #include

    #define MAX 75
    #define true 1
    #define false 0

    char stack[MAX];
    int top;

    void init(void);
    int full(void);
    int empty(void);
    char pop(void);
    void clear(void);
    void push(char info);

    main()
    {
    char pilih;
    char kal[75];
    int k,p;

    printf(“– Membalik Kata Dengan Stack –\n”);
    init();

    do
    {
    printf(“MENU PILIHAN :\n”);
    printf(“[1] Masukkan kata\n”);
    printf(“[2] Palindrom\n”);
    printf(“[3] Pseudopalindrom\n”);
    printf(“[4] Selesai\n”);
    printf(” Pilihan :”);
    scanf(“%s”,&pilih);
    switch(pilih)
    {

    case’1′ :
    printf(“Masukkan kata:”);
    scanf(“%s”,&kal);
    p=strlen(kal);
    for(k=0;k<=p;k++)
    push(kal[k]);
    printf("kata yang masuk:");
    for(k=1;k=1;k–)
    printf(“%c”,pop());
    printf(“\n”);
    }
    else printf(“Stack kosong\n”);
    break;
    case’3′ :
    if(empty()!=true)
    {
    printf(“Pseudopalindrom anda adalah :”);
    for(k=top;k>=1;k–)
    printf(“%c”,pop());
    printf(“\n”);
    }
    else printf(“Stack kosong\n”);
    break;
    case’4′ :
    break;
    default : printf(“Salah pilih .. \n”);
    }
    printf(“\n”);
    }
    while(pilih!=’4′);
    }

    void init(void)
    {
    top=0;
    }

    void push(char info)
    {
    if (full()!=true)
    {
    top++;
    stack[top]=info;
    }
    else
    printf(“Stack overflow .. \n”);
    }

    char pop(void)
    {
    char info;

    if (empty()!=true)
    {
    info=stack[top];
    top–;
    return(info);
    }

    else
    printf(“Stack underflow .. \n”);
    }

    int full(void)
    {
    if(top==MAX)
    return(true);
    else
    return(false);
    }

    int empty(void)
    {
    if(top==0)
    return(true);
    else
    return(false);
    }

  50. // Anggraeni Dwi P.
    // 09.11.3380
    // S1 TI 3K

    // hasil dari program

    Microsoft Windows [Version 6.1.7600]
    Copyright (c) 2009 Microsoft Corporation. All rights reserved.
    C:\Users\reniee >d:
    D:\>cd kuliah
    D:\kuliah>javac “ClsPalendrom.java”
    D:\kuliah>java ClsPalendrom
    Masukan Kata :
    tamat
    Tergolong Pseudopalendrom : tamat
    D:\kuliah>javac “ClsPalendrom.java”
    D:\kuliah>java ClsPalendrom
    Masukan Kata :
    purworejo
    Tergolong Palendrom : ojerowrup
    D:\kuliah>

  51. // Anggraeni Dwi P.
    // 09.11.3380
    // S1 TI 3K

    // coding

    import java.io.BufferedReader;
    import java.io.IOException;
    import java.io.InputStreamReader;

    public class ClsPalendrom {
    public static void main(String[] args) {
    int i = 0;
    String tmp1 = “”;
    String tmp2 = “”;

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

    System.out.println(“Masukan Kata : “);
    try {
    tmp1 = BacaText.readLine();
    } catch(IOException ex) {
    ex.printStackTrace();
    }

    for (i = 0; i < tmp1.length(); i++) {
    tmp2 = tmp1.substring(i, i + 1) + tmp2;
    }

    if (tmp1.matches(tmp2)) {
    System.out.print("Tergolong Pseudopalendrom : ");
    System.out.println(tmp1);
    } else {
    System.out.print("Tergolong Palendrom : ");
    System.out.println(tmp2);
    }
    }
    }

  52. // Tjatur Susetio Prabowo
    // 09.11.3370
    // S1 TI 3K

    // HASIL DARI PROGRAM

    Microsoft Windows [Version 6.1.7600]
    Copyright (c) 2009 Microsoft Corporation. All rights reserved.
    C:\Users\catur >d:
    D:\>cd kuliah
    D:\kuliah>javac “ClsPalendrom.java”
    D:\kuliah>java ClsPalendrom
    Masukan Kata :
    kodok
    Tergolong Pseudopalendrom : kodok
    D:\kuliah>javac “ClsPalendrom.java”
    D:\kuliah>java ClsPalendrom
    Masukan Kata :
    mandala
    Tergolong Palendrom : aladnam
    D:\kuliah>

  53. // Tjatur Susetio Prabowo
    // 09.11.3370
    // S1 TI 3K

    // CODING

    import java.io.BufferedReader;
    import java.io.IOException;
    import java.io.InputStreamReader;

    public class ClsPalendrom {
    public static void main(String[] args) {
    int i = 0;
    String tmp1 = “”;
    String tmp2 = “”;

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

    System.out.println(“Masukan Kata : “);
    try {
    tmp1 = BacaText.readLine();
    } catch(IOException ex) {
    ex.printStackTrace();
    }

    for (i = 0; i < tmp1.length(); i++) {
    tmp2 = tmp1.substring(i, i + 1) + tmp2;
    }

    if (tmp1.matches(tmp2)) {
    System.out.print("Tergolong Pseudopalendrom : ");
    System.out.println(tmp1);
    } else {
    System.out.print("Tergolong Palendrom : ");
    System.out.println(tmp2);
    }
    }
    }

  54. // Uci Hartati
    // 09.11.3373
    // S1 TI 3K

    // HASIL DARI PROGRAM

    Microsoft Windows [Version 6.1.7600]
    Copyright (c) 2009 Microsoft Corporation. All rights reserved.
    C:\Users\uci >d:
    D:\>cd kuliah
    D:\kuliah>javac “ClsPalendrom.java”
    D:\kuliah>java ClsPalendrom
    Masukan Kata :
    Kasur rusak
    Tergolong Pseudopalendrom : kasur rusak
    D:\kuliah>javac “ClsPalendrom.java”
    D:\kuliah>java ClsPalendrom
    Masukan Kata :
    amikom
    Tergolong Palendrom : mokima
    D:\kuliah>

  55. // Uci Hartati
    // 09.11.3373
    // S1 TI 3K

    // CODING

    import java.io.BufferedReader;
    import java.io.IOException;
    import java.io.InputStreamReader;

    public class ClsPalendrom {
    public static void main(String[] args) {
    int i = 0;
    String tmp1 = “”;
    String tmp2 = “”;

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

    System.out.println(“Masukan Kata : “);
    try {
    tmp1 = BacaText.readLine();
    } catch(IOException ex) {
    ex.printStackTrace();
    }

    for (i = 0; i < tmp1.length(); i++) {
    tmp2 = tmp1.substring(i, i + 1) + tmp2;
    }

    if (tmp1.matches(tmp2)) {
    System.out.print("Tergolong Pseudopalendrom : ");
    System.out.println(tmp1);
    } else {
    System.out.print("Tergolong Palendrom : ");
    System.out.println(tmp2);
    }
    }
    }

  56. // Irsyad Noor Huda
    // 09.11.3343
    // SI TI 3K

    // HASIL DARI PROGRAM

    Microsoft Windows [Version 6.1.7600]
    Copyright (c) 2009 Microsoft Corporation. All rights reserved.
    C:\Users\irsyad>d:
    D:\>cd kuliah
    D:\kuliah>javac “ClsPalendrom.java”
    D:\kuliah>java ClsPalendrom
    Masukan Kata :
    malam
    Tergolong Pseudopalendrom : malam
    D:\kuliah>javac “ClsPalendrom.java”
    D:\kuliah>java ClsPalendrom
    Masukan Kata :
    kasur
    Tergolong Palendrom : rusak
    D:\kuliah>

  57. // Irsyad Noor Huda
    // 09.11.3343
    // SI TI 3K

    // CODING

    import java.io.BufferedReader;
    import java.io.IOException;
    import java.io.InputStreamReader;

    public class ClsPalendrom {
    public static void main(String[] args) {
    int i = 0;
    String tmp1 = “”;
    String tmp2 = “”;

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

    System.out.println(“Masukan Kata : “);
    try {
    tmp1 = BacaText.readLine();
    } catch(IOException ex) {
    ex.printStackTrace();
    }

    for (i = 0; i < tmp1.length(); i++) {
    tmp2 = tmp1.substring(i, i + 1) + tmp2;
    }

    if (tmp1.matches(tmp2)) {
    System.out.print("Tergolong Pseudopalendrom : ");
    System.out.println(tmp1);
    } else {
    System.out.print("Tergolong Palendrom : ");
    System.out.println(tmp2);
    }
    }
    }

  58. // Irsyad noor huda
    // 09.11.3343
    // S1 TI 3K

    // CODING

    import java.io.BufferedReader;
    import java.io.IOException;
    import java.io.InputStreamReader;

    public class ClsPalendrom {
    public static void main(String[] args) {
    int i = 0;
    String tmp1 = “”;
    String tmp2 = “”;

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

    System.out.println(“Masukan Kata : “);
    try {
    tmp1 = BacaText.readLine();
    } catch(IOException ex) {
    ex.printStackTrace();
    }

    for (i = 0; i d:

    D:\>cd kuliah

    D:\kuliah>javac “ClsPalendrom.java”

    D:\kuliah>java ClsPalendrom
    Masukan Kata :
    malam
    Tergolong Pseudopalendrom : malam

    D:\kuliah>javac “ClsPalendrom.java”

    D:\kuliah>java ClsPalendrom
    Masukan Kata :
    kasur
    Tergolong Palendrom : rusak

    D:\kuliah>

  59. //Irsyad noor huda
    // 09.11.3343
    // S1-TI-3K

    //CODING

    import java.io.BufferedReader;
    import java.io.IOException;
    import java.io.InputStreamReader;

    public class ClsPalendrom {
    public static void main(String[] args) {
    int i = 0;
    String tmp1 = “”;
    String tmp2 = “”;

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

    System.out.println(“Masukan Kata : “);
    try {
    tmp1 = BacaText.readLine();
    } catch(IOException ex) {
    ex.printStackTrace();
    }

    for (i = 0; i d:

    D:\>cd kuliah

    D:\kuliah>javac “ClsPalendrom.java”

    D:\kuliah>java ClsPalendrom
    Masukan Kata :
    malam
    Tergolong Pseudopalendrom : malam

    D:\kuliah>javac “ClsPalendrom.java”

    D:\kuliah>java ClsPalendrom
    Masukan Kata :
    kasur
    Tergolong Palendrom : rusak

    D:\kuliah>

  60. public class ClsPalendrom {
    public static void main(String[] args) {
    int i = 0;
    String tmp1 = “”;
    String tmp2 = “”;

    System.out.println(“Masukan Kata : “);
    tmp1 = “seles”;

    for (i = 0; i < tmp1.length(); i++) {
    tmp2 = tmp1.substring(i, i + 1) + tmp2;
    }

    if (tmp1.matches(tmp2)) {
    System.out.print("Tergolong Pseudopalendrom : ");
    System.out.println(tmp1);
    } else {
    System.out.print("Tergolong Palendrom : ");
    System.out.println(tmp2);
    }
    }
    }

    sofian : 09.11.3386

  61. //nama:Krisna Bayu Aji //
    //nim:09.11.3313//
    #include

    #include

    main()

    {

    int jmlh, i, j, k, l;

    char kata[10];

    cout<>jmlh;

    cout<<"Masukkan kata = ";

    for (i=0;i>kata[i];}

    cout<=0;j–)

    {cout<<kata[j];}

    cout<<"\nPseudo Palendrom = ";

    for (k=0;k<jmlh;k++)

    {

    cout<<kata[k];

    }

    cout<=0;l–)

    {

    cout<<kata[l];

    }

    getch();

    }

  62. //nama:mulyadi//
    //nim:09.11.3332//
    #include

    #include

    main()

    {

    int jmlh, i, j, k, l;

    char kata[10];

    cout<>jmlh;

    cout<<"Masukkan kata = ";

    for (i=0;i>kata[i];}

    cout<=0;j–)

    {cout<<kata[j];}

    cout<<"\nPseudo Palendrom = ";

    for (k=0;k<jmlh;k++)

    {

    cout<<kata[k];

    }

    cout<=0;l–)

    {

    cout<<kata[l];

    }

    getch();

    }

  63. public class ClsPalendrom {
    public static void main(String[] args) {
    int i = 0;
    String tmp1 = “”;
    String tmp2 = “”;

    System.out.println(“Masukan Kata : “);
    tmp1 = “kodok”;

    for (i = 0; i < tmp1.length(); i++) {
    tmp2 = tmp1.substring(i, i + 1) + tmp2;
    }

    if (tmp1.matches(tmp2)) {
    System.out.print("Tergolong Pseudopalendrom : ");
    System.out.println(tmp1);
    } else {
    System.out.print("Tergolong Palendrom : ");
    System.out.println(tmp2);
    }
    }
    }

    Yanuar Habib P
    09.11.3316 / S1.TI.3K

  64. nama: yogi anggriawan
    nim: 09.11.3338

    public class ClsPalendrom {
    public static void main(String[] args) {
    int i = 0;
    String tmp1 = “”;
    String tmp2 = “”;

    System.out.println(“Inputkan Katamu : “);
    tmp1 = “Anna”;

    for (i = 0; i < tmp1.length(); i++) {
    tmp2 = tmp1.substring(i, i + 1) + tmp2;
    }

    if (tmp1.matches(tmp2)) {
    System.out.print("Tergolong Pseudopalendrom : ");
    System.out.println(tmp1);
    } else {
    System.out.print("Merupakan Palendrom : ");
    System.out.println(tmp2);
    }
    }
    }

    Tampilan:
    Inputkan Katamu : Anna
    Tergolong Palendrom : Anna

  65. public class ClsPalendrom {
    public static void main(String[] args) {
    int i = 0;
    String tmp1 = “”;
    String tmp2 = “”;

    System.out.println(“Masukan Kata : “);
    tmp1 = “tamat”;

    for (i = 0; i < tmp1.length(); i++) {
    tmp2 = tmp1.substring(i, i + 1) + tmp2;
    }

    if (tmp1.matches(tmp2)) {
    System.out.print("Tergolong Pseudopalendrom : ");
    System.out.println(tmp1);
    } else {
    System.out.print("Tergolong Palendrom : ");
    System.out.println(tmp2);
    }
    }
    }

    Erry Maricha Oki NH
    09.11.3335 / S1.TI.3K

  66. public class ClsPalendrom {
    public static void main(String[] args) {
    int i = 0;
    String tmp1 = “”;
    String tmp2 = “”;

    System.out.println(“Masukan Kata : “);
    tmp1 = “katak”;

    for (i = 0; i < tmp1.length(); i++) {
    tmp2 = tmp1.substring(i, i + 1) + tmp2;
    }

    if (tmp1.matches(tmp2)) {
    System.out.print("Tergolong Pseudopalendrom : ");
    System.out.println(tmp1);
    } else {
    System.out.print("Tergolong Palendrom : ");
    System.out.println(tmp2);
    }
    }
    }

    Bangun Watono
    09.11.3360 / S1.TI.3K

  67. Nama : Marimin
    Kelas : SI TI 3K
    NIM : 09.11.3364
    public class TugasMatematikaDiskrit {
    public static void main(String[] args) {
    int i = 0;
    String tmp1 = “”;
    String tmp2 = “”;

    System.out.println(“Masukan Kata yang ingin dibalik : “);
    tmp1 = “MADAM I’m MADAM”;

    for (i = 0; i < tmp1.length(); i++) {
    tmp2 = tmp1.substring(i, i + 1) + tmp2;
    }

    if (tmp1.matches(tmp2)) {
    System.out.print("Kata yang anda masukkan termasuk Pseudopalendrom : ");
    System.out.println(tmp1);
    } else {
    System.out.print("Kata yang anda masukkan termasuk Palendrom : ");
    System.out.println(tmp2);
    }}}

    Hasil Output :
    Masukan Kata yang ingin dibalik :
    Kata yang anda masukkan termasuk Pseudopalendrom : MADAM I’m MADAM

  68. Nama : Marimin
    Kelas : SI TI 3K
    NIM : 09.11.3364

    public class TugasMatematikaDiskrit {
    public static void main(String[] args) {
    int i = 0;
    String tmp1 = “”;
    String tmp2 = “”;

    System.out.println(“Masukan Kata yang ingin dibalik : “);
    tmp1 = “MADAM I’m MADAM”;

    for (i = 0; i < tmp1.length(); i++) {
    tmp2 = tmp1.substring(i, i + 1) + tmp2;
    }

    if (tmp1.matches(tmp2)) {
    System.out.print("Kata yang anda masukkan termasuk Pseudopalendrom : ");
    System.out.println(tmp1);
    } else {
    System.out.print("Kata yang anda masukkan termasuk Palendrom : ");
    System.out.println(tmp2);
    }}}
    Hasil Output :
    Masukan Kata yang ingin dibalik :
    Kata yang anda masukkan termasuk Pseudopalendrom : MADAM I’m MADAM

  69. #include
    #include
    #define MAX 50

    void main() {
    int i, j, Stat;
    int p, q, n, m;
    int x[MAX];
    int y[MAX];
    int xny[MAX], xuy[MAX];

    n = 0;
    printf(” Program Mencari Irisan dan Gabungan Himpunan \n”);
    printf(“\nMasukan jumlah Himpunan x : “);
    scanf(“%d”, &n);
    for(i = 0; i < n; i++) {
    printf("Masukkan Nilai : ");
    scanf("%d", &x[i]);
    }
    printf("x = {%i", x[0]);
    for(i = 1; i < n; i++) {
    printf(",%d", x[i]);
    }
    printf("}\n");

    m = 0;
    printf("Masukan jumlah Himpunan y : ");
    scanf("%d", &m);
    for(i = 0; i < m; i++) {
    printf("Masukkan Nilai : ");
    scanf("%d", &y[i]);
    }
    printf("y = {%i", y[0]);
    for(i = 1; i < m; i++) {
    printf(",%d", y[i]);
    }
    printf("}\n");

    p = 0;
    for(i = 0; i < n; i++) {
    for(j = 0; j < m; j++) {
    if(x[i] == y[j]) {
    xny[p] = y[j];
    p = p + 1;
    }
    }
    }
    printf("Maka x irisan y adalah…\n");
    printf("xny = {%d", xny[0]);
    for(i = 1; i < p; i++) {
    printf(",%d", xny[i]);
    }
    printf("}\n");

    Stat = 0;
    q = n;
    for(i = 0; i < n; i++) {
    xuy[i] = x[i];
    }
    for(j = 0; j < m; j++) {
    Stat = 0;
    for(i = 0; i < n; i++) {
    if(y[j] == x[i]) {
    Stat = 1;
    }
    }

    if(Stat == 0) {
    xuy[q] = y[j];
    q = q + 1;
    }
    }

    printf("Maka x gabung y adalah…\n");
    printf("xuy = {%d", xuy[0]);
    for(i = 1; i < q; i++) {
    printf(",%d", xuy[i]);
    }
    printf("}\n");

    getch();
    }

  70. #include
    #include

    #define MAX 75
    #define true 1
    #define false 0

    char stack[MAX];
    int top;

    void init(void);
    int full(void);
    int empty(void);
    char pop(void);
    void clear(void);
    void push(char info);

    main()
    {
    char pilih;
    char kal[75];
    int k,p;

    printf(“– Membalik Kata Dengan Stack –\n”);
    init();

    do
    {
    printf(“MENU PILIHAN :\n”);
    printf(“[1] Masukkan kata\n”);
    printf(“[2] Palindrom\n”);
    printf(“[3] Pseudopalindrom\n”);
    printf(“[4] Selesai\n”);
    printf(” Pilihan :”);
    scanf(“%s”,&pilih);
    switch(pilih)
    {

    case’1′ :
    printf(“Masukkan kata:”);
    scanf(“%s”,&kal);
    p=strlen(kal);
    for(k=0;k<=p;k++)
    push(kal[k]);
    printf("kata yang masuk:");
    for(k=1;k=1;k–)
    printf(“%c”,pop());
    printf(“\n”);
    }
    else printf(“Stack kosong\n”);
    break;
    case’3′ :
    if(empty()!=true)
    {
    printf(“Pseudopalindrom anda adalah :”);
    for(k=top;k>=1;k–)
    printf(“%c”,pop());
    printf(“\n”);
    }
    else printf(“Stack kosong\n”);
    break;
    case’4′ :
    break;
    default : printf(“Salah pilih .. \n”);
    }
    printf(“\n”);
    }
    while(pilih!=’4′);
    }

    void init(void)
    {
    top=0;
    }

    void push(char info)
    {
    if (full()!=true)
    {
    top++;
    stack[top]=info;
    }
    else
    printf(“Stack overflow .. \n”);
    }

    char pop(void)
    {
    char info;

    if (empty()!=true)
    {
    info=stack[top];
    top–;
    return(info);
    }

    else
    printf(“Stack underflow .. \n”);
    }

    int full(void)
    {
    if(top==MAX)
    return(true);
    else
    return(false);
    }

    int empty(void)
    {
    if(top==0)
    return(true);
    else
    return(false);
    }

    OUTPUT PROGRAM
    –Membalik Kata Dengan Stack–
    MENU PILIHAN :
    [1] Masukkan kata
    [2] Palindrom
    [3] Pseudopalindrom
    [4] Selesai
    Pilihan : 1
    Masukkan kata : makan
    Kata yang masuk : makan

    MENU PILIHAN :
    [1] Masukkan kata
    [2] Palindrom
    [3] Pseudopalindrom
    [4] Selesai
    Pilihan : 2
    Palindrom anda adalah : nakam

    MENU PILIHAN :
    [1] Masukkan kata
    [2] Palindrom
    [3] Pseudopalindrom
    [4] Selesai
    Pilihan : 1
    Masukkan kata : sapa
    Kata yang masuk : sapa

    MENU PILIHAN :
    [1] Masukkan kata
    [2] Palindrom
    [3] Pseudopalindrom
    [4] Selesai
    Pilihan :1
    Masukkan kata : apas
    Kata yang masuk : sapaapas

    MENU PILIHAN :
    [1] Masukkan kata
    [2] Palindrom
    [3] Pseudopalindrom
    [4] Selesai
    Pilihan :3
    Pseudopalindrom anda adalah : sapaapas

    MENU PILIHAN :
    [1] Masukkan kata
    [2] Palindrom
    [3] Pseudopalindrom
    [4] Selesai
    Pilihan :4

  71. /* —————————————-*/
    /* —- Palindrom dan Pseudopalindrom —-*/
    /* By Mawaddah Aynurrohmah */
    /* —————————————-*/

    #include
    #include

    #define MAX 75
    #define true 1
    #define false 0

    char stack[MAX];
    int top;

    void init(void);
    int full(void);
    int empty(void);
    char pop(void);
    void clear(void);
    void push(char info);

    main()
    {
    char pilih;
    char kal[75];
    int k,p;

    printf(“– Membalik Kata Dengan Stack –\n”);
    init();

    do
    {
    printf(“MENU PILIHAN :\n”);
    printf(“[1] Masukkan kata\n”);
    printf(“[2] Palindrom\n”);
    printf(“[3] Pseudopalindrom\n”);
    printf(“[4] Selesai\n”);
    printf(” Pilihan :”);
    scanf(“%s”,&pilih);
    switch(pilih)
    {

    case’1′ :
    printf(“Masukkan kata:”);
    scanf(“%s”,&kal);
    p=strlen(kal);
    for(k=0;k<=p;k++)
    push(kal[k]);
    printf("kata yang masuk:");
    for(k=1;k=1;k–)
    printf(“%c”,pop());
    printf(“\n”);
    }
    else printf(“Stack kosong\n”);
    break;
    case’3′ :
    if(empty()!=true)
    {
    printf(“Pseudopalindrom anda adalah :”);
    for(k=top;k>=1;k–)
    printf(“%c”,pop());
    printf(“\n”);
    }
    else printf(“Stack kosong\n”);
    break;
    case’4′ :
    break;
    default : printf(“Salah pilih .. \n”);
    }
    printf(“\n”);
    }
    while(pilih!=’4′);
    }

    void init(void)
    {
    top=0;
    }

    void push(char info)
    {
    if (full()!=true)
    {
    top++;
    stack[top]=info;
    }
    else
    printf(“Stack overflow .. \n”);
    }

    char pop(void)
    {
    char info;

    if (empty()!=true)
    {
    info=stack[top];
    top–;
    return(info);
    }

    else
    printf(“Stack underflow .. \n”);
    }

    int full(void)
    {
    if(top==MAX)
    return(true);
    else
    return(false);
    }

    int empty(void)
    {
    if(top==0)
    return(true);
    else
    return(false);
    }

    OUTPUT PROGRAM
    –Membalik Kata Dengan Stack–
    MENU PILIHAN :
    [1] Masukkan kata
    [2] Palindrom
    [3] Pseudopalindrom
    [4] Selesai
    Pilihan : 1
    Masukkan kata : KASUR
    Kata yang masuk : KASUR

    MENU PILIHAN :
    [1] Masukkan kata
    [2] Palindrom
    [3] Pseudopalindrom
    [4] Selesai
    Pilihan : 2
    Palindrom anda adalah : RUSAK

    MENU PILIHAN :
    [1] Masukkan kata
    [2] Palindrom
    [3] Pseudopalindrom
    [4] Selesai
    Pilihan : 1
    Masukkan kata : KASUR
    Kata yang masuk : KASUR

    MENU PILIHAN :
    [1] Masukkan kata
    [2] Palindrom
    [3] Pseudopalindrom
    [4] Selesai
    Pilihan :1
    Masukkan kata : RUSAK
    Kata yang masuk : KASURRUSAK

    MENU PILIHAN :
    [1] Masukkan kata
    [2] Palindrom
    [3] Pseudopalindrom
    [4] Selesai
    Pilihan :3
    Pseudopalindrom anda adalah : KASURRUSAK

    MENU PILIHAN :
    [1] Masukkan kata
    [2] Palindrom
    [3] Pseudopalindrom
    [4] Selesai
    Pilihan :4

  72. /* —————————————-*/
    /* —- Palindrom dan Pseudopalindrom —-*/
    /* By Mawaddah Aynurrohmah */
    /* —————————————-*/

    #include
    #include

    #define MAX 75
    #define true 1
    #define false 0

    char stack[MAX];
    int top;

    void init(void);
    int full(void);
    int empty(void);
    char pop(void);
    void clear(void);
    void push(char info);

    main()
    {
    char pilih;
    char kal[75];
    int k,p;

    printf(“– Membalik Kata Dengan Stack –\n”);
    init();

    do
    {
    printf(“MENU PILIHAN :\n”);
    printf(“[1] Masukkan kata\n”);
    printf(“[2] Palindrom\n”);
    printf(“[3] Pseudopalindrom\n”);
    printf(“[4] Selesai\n”);
    printf(” Pilihan :”);
    scanf(“%s”,&pilih);
    switch(pilih)
    {

    case’1′ :
    printf(“Masukkan kata:”);
    scanf(“%s”,&kal);
    p=strlen(kal);
    for(k=0;k<=p;k++)
    push(kal[k]);
    printf("kata yang masuk:");
    for(k=1;k=1;k–)
    printf(“%c”,pop());
    printf(“\n”);
    }
    else printf(“Stack kosong\n”);
    break;
    case’3′ :
    if(empty()!=true)
    {
    printf(“Pseudopalindrom anda adalah :”);
    for(k=top;k>=1;k–)
    printf(“%c”,pop());
    printf(“\n”);
    }
    else printf(“Stack kosong\n”);
    break;
    case’4′ :
    break;
    default : printf(“Salah pilih .. \n”);
    }
    printf(“\n”);
    }
    while(pilih!=’4′);
    }

    void init(void)
    {
    top=0;
    }

    void push(char info)
    {
    if (full()!=true)
    {
    top++;
    stack[top]=info;
    }
    else
    printf(“Stack overflow .. \n”);
    }

    char pop(void)
    {
    char info;

    if (empty()!=true)
    {
    info=stack[top];
    top–;
    return(info);
    }

    else
    printf(“Stack underflow .. \n”);
    }

    int full(void)
    {
    if(top==MAX)
    return(true);
    else
    return(false);
    }

    int empty(void)
    {
    if(top==0)
    return(true);
    else
    return(false);
    }

    OUTPUT PROGRAM
    –Membalik Kata Dengan Stack–
    MENU PILIHAN :
    [1] Masukkan kata
    [2] Palindrom
    [3] Pseudopalindrom
    [4] Selesai
    Pilihan : 1
    Masukkan kata : KASUR
    Kata yang masuk : KASUR

    MENU PILIHAN :
    [1] Masukkan kata
    [2] Palindrom
    [3] Pseudopalindrom
    [4] Selesai
    Pilihan : 2
    Palindrom anda adalah : RUSAK

    MENU PILIHAN :
    [1] Masukkan kata
    [2] Palindrom
    [3] Pseudopalindrom
    [4] Selesai
    Pilihan : 1
    Masukkan kata : KASUR
    Kata yang masuk : KASUR

    MENU PILIHAN :
    [1] Masukkan kata
    [2] Palindrom
    [3] Pseudopalindrom
    [4] Selesai
    Pilihan :1
    Masukkan kata : RUSAK
    Kata yang masuk : KASURRUSAK

    MENU PILIHAN :
    [1] Masukkan kata
    [2] Palindrom
    [3] Pseudopalindrom
    [4] Selesai
    Pilihan :4

  73. /* —————————————-*/
    /* —- Palindrom dan Pseudopalindrom —-*/
    /* By Mawaddah Aynurrohmah */
    /* —————————————-*/

    #include
    #include

    #define MAX 75
    #define true 1
    #define false 0

    char stack[MAX];
    int top;

    void init(void);
    int full(void);
    int empty(void);
    char pop(void);
    void clear(void);
    void push(char info);

    main()
    {
    char pilih;
    char kal[75];
    int k,p;

    printf(“– Membalik Kata Dengan Stack –\n”);
    init();

    do
    {
    printf(“MENU PILIHAN :\n”);
    printf(“[1] Masukkan kata\n”);
    printf(“[2] Palindrom\n”);
    printf(“[3] Pseudopalindrom\n”);
    printf(“[4] Selesai\n”);
    printf(” Pilihan :”);
    scanf(“%s”,&pilih);
    switch(pilih)
    {

    case’1′ :
    printf(“Masukkan kata:”);
    scanf(“%s”,&kal);
    p=strlen(kal);
    for(k=0;k<=p;k++)
    push(kal[k]);
    printf("kata yang masuk:");
    for(k=1;k=1;k–)
    printf(“%c”,pop());
    printf(“\n”);
    }
    else printf(“Stack kosong\n”);
    break;
    case’3′ :
    if(empty()!=true)
    {
    printf(“Pseudopalindrom anda adalah :”);
    for(k=top;k>=1;k–)
    printf(“%c”,pop());
    printf(“\n”);
    }
    else printf(“Stack kosong\n”);
    break;
    case’4′ :
    break;
    default : printf(“Salah pilih .. \n”);
    }
    printf(“\n”);
    }
    while(pilih!=’4′);
    }

    void init(void)
    {
    top=0;
    }

    void push(char info)
    {
    if (full()!=true)
    {
    top++;
    stack[top]=info;
    }
    else
    printf(“Stack overflow .. \n”);
    }

    char pop(void)
    {
    char info;

    if (empty()!=true)
    {
    info=stack[top];
    top–;
    return(info);
    }

    else
    printf(“Stack underflow .. \n”);
    }

    int full(void)
    {
    if(top==MAX)
    return(true);
    else
    return(false);
    }

    int empty(void)
    {
    if(top==0)
    return(true);
    else
    return(false);
    }

    OUTPUT PROGRAM
    –Membalik Kata Dengan Stack–
    MENU PILIHAN :
    [1] Masukkan kata
    [2] Palindrom
    [3] Pseudopalindrom
    [4] Selesai
    Pilihan : 1
    Masukkan kata : KASUR
    Kata yang masuk : KASUR

    MENU PILIHAN :
    [1] Masukkan kata
    [2] Palindrom
    [3] Pseudopalindrom
    [4] Selesai
    Pilihan : 2
    Palindrom anda adalah : RUSAK

    MENU PILIHAN :
    [1] Masukkan kata
    [2] Palindrom
    [3] Pseudopalindrom
    [4] Selesai
    Pilihan : 1
    Masukkan kata : KASUR
    Kata yang masuk : KASUR

    MENU PILIHAN :
    [1] Masukkan kata
    [2] Palindrom
    [3] Pseudopalindrom
    [4] Selesai
    Pilihan :1
    Masukkan kata : RUSAK
    Kata yang masuk : KASURRUSAK

    MENU PILIHAN :
    [1] Masukkan kata
    [2] Palindrom
    [3] Pseudopalindrom
    [4] Selesai
    Pilihan :4

  74. #include
    #include

    #define MAX 75
    #define true 1
    #define false 0

    char stack[MAX];
    int top;

    void init(void);
    int full(void);
    int empty(void);
    char pop(void);
    void clear(void);
    void push(char info);

    main()
    {
    char pilih;
    char kal[75];
    int k,p;

    printf(“– Membalik Kata Dengan Stack –\n”);
    init();

    do
    {
    printf(“MENU PILIHAN :\n”);
    printf(“[1] Masukkan kata\n”);
    printf(“[2] Palindrom\n”);
    printf(“[3] Pseudopalindrom\n”);
    printf(“[4] Selesai\n”);
    printf(” Pilihan :”);
    scanf(“%s”,&pilih);
    switch(pilih)
    {

    case’1′ :
    printf(“Masukkan kata:”);
    scanf(“%s”,&kal);
    p=strlen(kal);
    for(k=0;k<=p;k++)
    push(kal[k]);
    printf("kata yang masuk:");
    for(k=1;k=1;k–)
    printf(“%c”,pop());
    printf(“\n”);
    }
    else printf(“Stack kosong\n”);
    break;
    case’3′ :
    if(empty()!=true)
    {
    printf(“Pseudopalindrom anda adalah :”);
    for(k=top;k>=1;k–)
    printf(“%c”,pop());
    printf(“\n”);
    }
    else printf(“Stack kosong\n”);
    break;
    case’4′ :
    break;
    default : printf(“Salah pilih .. \n”);
    }
    printf(“\n”);
    }
    while(pilih!=’4′);
    }

    void init(void)
    {
    top=0;
    }

    void push(char info)
    {
    if (full()!=true)
    {
    top++;
    stack[top]=info;
    }
    else
    printf(“Stack overflow .. \n”);
    }

    char pop(void)
    {
    char info;

    if (empty()!=true)
    {
    info=stack[top];
    top–;
    return(info);
    }

    else
    printf(“Stack underflow .. \n”);
    }

    int full(void)
    {
    if(top==MAX)
    return(true);
    else
    return(false);
    }

    int empty(void)
    {
    if(top==0)
    return(true);
    else
    return(false);
    }

    OUTPUT PROGRAM
    –Membalik Kata Dengan Stack–
    MENU PILIHAN :
    [1] Masukkan kata
    [2] Palindrom
    [3] Pseudopalindrom
    [4] Selesai
    Pilihan : 1
    Masukkan kata : makan
    Kata yang masuk : makan

    MENU PILIHAN :
    [1] Masukkan kata
    [2] Palindrom
    [3] Pseudopalindrom
    [4] Selesai
    Pilihan : 2
    Palindrom anda adalah : nakam

    MENU PILIHAN :
    [1] Masukkan kata
    [2] Palindrom
    [3] Pseudopalindrom
    [4] Selesai
    Pilihan : 1
    Masukkan kata : sapa
    Kata yang masuk : sapa

    MENU PILIHAN :
    [1] Masukkan kata
    [2] Palindrom
    [3] Pseudopalindrom
    [4] Selesai
    Pilihan :1
    Masukkan kata : apas
    Kata yang masuk : sapaapas

    MENU PILIHAN :
    [1] Masukkan kata
    [2] Palindrom
    [3] Pseudopalindrom
    [4] Selesai
    Pilihan :4

  75. /* —————————————-*/
    /* —- Palindrom dan Pseudopalindrom —-*/
    /* By Mawaddah Aynurrohmah */
    /* —————————————-*/

    #include
    #include

    #define MAX 75
    #define true 1
    #define false 0

    char stack[MAX];
    int top;

    void init(void);
    int full(void);
    int empty(void);
    char pop(void);
    void clear(void);
    void push(char info);

    main()
    {
    char pilih;
    char kal[75];
    int k,p;

    printf(“– Membalik Kata Dengan Stack –\n”);
    init();

    do
    {
    printf(“MENU PILIHAN :\n”);
    printf(“[1] Masukkan kata\n”);
    printf(“[2] Palindrom\n”);
    printf(“[3] Pseudopalindrom\n”);
    printf(“[4] Selesai\n”);
    printf(” Pilihan :”);
    scanf(“%s”,&pilih);
    switch(pilih)
    {

    case’1′ :
    printf(“Masukkan kata:”);
    scanf(“%s”,&kal);
    p=strlen(kal);
    for(k=0;k<=p;k++)
    push(kal[k]);
    printf("kata yang masuk:");
    for(k=1;k=1;k–)
    printf(“%c”,pop());
    printf(“\n”);
    }
    else printf(“Stack kosong\n”);
    break;
    case’3′ :
    if(empty()!=true)
    {
    printf(“Pseudopalindrom anda adalah :”);
    for(k=top;k>=1;k–)
    printf(“%c”,pop());
    printf(“\n”);
    }
    else printf(“Stack kosong\n”);
    break;
    case’4′ :
    break;
    default : printf(“Salah pilih .. \n”);
    }
    printf(“\n”);
    }
    while(pilih!=’4′);
    }

    void init(void)
    {
    top=0;
    }

    void push(char info)
    {
    if (full()!=true)
    {
    top++;
    stack[top]=info;
    }
    else
    printf(“Stack overflow .. \n”);
    }

    char pop(void)
    {
    char info;

    if (empty()!=true)
    {
    info=stack[top];
    top–;
    return(info);
    }

    else
    printf(“Stack underflow .. \n”);
    }

    int full(void)
    {
    if(top==MAX)
    return(true);
    else
    return(false);
    }

    int empty(void)
    {
    if(top==0)
    return(true);
    else
    return(false);
    }

    OUTPUT PROGRAM
    –Membalik Kata Dengan Stack–
    MENU PILIHAN :
    [1] Masukkan kata
    [2] Palindrom
    [3] Pseudopalindrom
    [4] Selesai
    Pilihan : 1
    Masukkan kata : KASUR
    Kata yang masuk : KASUR

    MENU PILIHAN :
    [1] Masukkan kata
    [2] Palindrom
    [3] Pseudopalindrom
    [4] Selesai
    Pilihan : 2
    Palindrom anda adalah : RUSAK

    MENU PILIHAN :
    [1] Masukkan kata
    [2] Palindrom
    [3] Pseudopalindrom
    [4] Selesai
    Pilihan : 1
    Masukkan kata : KASUR
    Kata yang masuk : KASUR

    MENU PILIHAN :
    [1] Masukkan kata
    [2] Palindrom
    [3] Pseudopalindrom
    [4] Selesai
    Pilihan :1
    Masukkan kata : RUSAK
    Kata yang masuk : KASURRUSAK

    MENU PILIHAN :
    [1] Masukkan kata
    [2] Palindrom
    [3] Pseudopalindrom
    [4] Selesai
    Pilihan :4

  76. Nama : Marimin
    Kelas : SI TI 3K
    NIM : 09.11.3364

    public class TugasMatematikaDiskrit {
    public static void main(String[] args) {
    int i = 0;
    String tmp1 = “”;
    String tmp2 = “”;

    System.out.println(“Masukan Kata yang ingin dibalik : “);
    tmp1 = “MADAM I’m MADAM”;

    for (i = 0; i < tmp1.length(); i++) {
    tmp2 = tmp1.substring(i, i + 1) + tmp2;
    }

    if (tmp1.matches(tmp2)) {
    System.out.print("Kata yang anda masukkan termasuk Pseudopalendrom : ");
    System.out.println(tmp1);
    } else {
    System.out.print("Kata yang anda masukkan termasuk Palendrom : ");
    System.out.println(tmp2);
    }}}

    Hasil Output :
    Masukan Kata yang ingin dibalik :
    Kata yang anda masukkan termasuk Pseudopalendrom : MADAM I’m MADAM

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s