palindrome number in given range code in c++


Program of palindrome number find no. in given range in c++
 Program of palindrome number in the range in c++
#include<iostream>
int main(){
    int num,r,sum,temp;
    int min,max;

    cout << "Enter the minimum range: ";
    cin >> min;

    cout << "Enter the maximum range: ";
    cin >>  max;

    cout << "Palindrome numbers in given range are: ";
    for(num=min;num<=max;num++){
         temp=num;
         sum=0;

         while(temp){
             r=temp%10;
             temp=temp/10;
             sum=sum*10+r;
         }
         if(num==sum)
            cout << num << " ";
    }
    return 0;
}


No comments:

Post a Comment