Nilai Polindrom dan Bukan Polindrom

#include <iostream>
#include <conio.h>
using namespace std;

int main()
{
      int help = 0,reverse,num,temp;
      cout<<"Masukan nilai : ";
      cin>>num;
      reverse = num;
   
      while (num !=0)
      {
           temp = num % 10;
           help = help * 10 + temp;
           num = num/10;
      }
      if (reverse == help)
      {
            cout<<"nilai polindrom";
      }
      else
      cout<<"Nilai bukan polindrom";
      system("pause");
      return 0;
}

No comments:

Post a Comment

Tutorial Lengkap Hosting Website Gratis Dengan Gambar

Hallo Guys.. sudah sangat lama sekali sejak terakhir kali saya melakukan posting di blogger ini... kalau saya tidak salah terakhir saya ...