StudyLover
  • Home
  • Study Zone
  • Profiles
  • Contact us
  • Sign in
StudyLover 3. Program to check if a given number is a palindrome.
Download
  1. C++ Programs list
2. Program to check whether a number is prime. : 4. Program to find the greatest common divisor (GCD).
C++ Programs list

1.      Program to check if a given number is a palindrome.

  1. #include <iostream.h>

  2. #include <conio.h>

  3. int main() {

  4.     int n, reversed = 0, remainder, original;

  5.     cout << "Enter an integer: ";

  6.     cin >> n;

  7.     original = n;

  8.     while (n != 0) {

  9.         remainder = n % 10;

  10.         reversed = reversed * 10 + remainder;

  11.                 n /= 10;

  12.     }

  13.     if (original == reversed)

  14.                 cout << original << " is a palindrome.\n";

  15.     else

  16.                 cout << original << " is not a palindrome.\n";

  17.     getch();

  18.     return 0;

  19. }

2. Program to check whether a number is prime. 4. Program to find the greatest common divisor (GCD).
Our Products & Services
  • Home
Connect with us
  • Contact us
  • +91 82955 87844
  • Rk6yadav@gmail.com

StudyLover - About us

The Best knowledge for Best people.

Copyright © StudyLover
Powered by Odoo - Create a free website