

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Program to print all palindromes in a given range in C++
<p>In this tutorial, we will be discussing a program to print all palindromes in a given range.</p><p>For this we will be given the mathematical range in which the palindromes are to be found. Our task is to find all the palindromes in that range and print it back.</p><h2>Example</h2><p><a class="demo" href="http://tpcg.io/oCa8CNXJ" rel="nofollow" target="_blank"> Live Demo</a></p><pre class="prettyprint notranslate">#include<iostream> using namespace std; //checking if the number is a palindrome int is_palin(int n){ int rev = 0; for (int i = n; i > 0; i /= 10) rev = rev*10 + i%10; return (n==rev); } void countPal(int min, int max){ for (int i = min; i <= max; i++) if (is_palin(i)) cout << i << " "; } int main(){ countPal(99, 250); return 0; }</pre><h2>Output</h2><pre class="result notranslate">99 101 111 121 131 141 151 161 171 181 191 202 212 222 232 242</pre>
- Related Questions & Answers
- Python Program to Print all Numbers in a Range Divisible by a Given Number
- Golang Program to Print all Numbers in a Range Divisible by a Given Number
- Print all Good numbers in given range in C++
- Python program to print all even numbers in a range
- Python program to print all odd numbers in a range
- Golang Program to Print Odd Numbers Within a Given Range
- Program to print prime numbers in a given range using C++ STL
- Python Program to Find All Numbers which are Odd and Palindromes Between a Range of Numbers
- Program to print all substrings of a given string in C++
- Python Program to print all permutations of a given string
- C Program to print all permutations of a given string
- Print prime numbers in a given range using C++ STL
- Print BST keys in the given range in C++
- Python program to print all distinct elements of a given integer array.
- Print all permutations of a given string
Advertisements