Answers for "how to print nth palindrome number in c++"

C++
0

how to print nth palindrome number in c++

if(n <=1000 && i==0){
               // cout << " here "<<endl;
                count =0;
                i=0;
               // break;
                
            }else if( n >1000 && n <=2000 && i==0){
                //cout << "there " <<endl;
                count =1000;
                i=90109;
               // break;
            }else if( n >2000 && n <=2500 && i==0){
                //cout << "there " <<endl;
                count =2000;
                i=1001001;
                // break;
            }else if( n >2500 && n <=3000 && i==0){
                //cout << "there " <<endl;
                count =2500;
                i=1501051;
                // break;
Posted by: Guest on March-12-2020
0

how to print nth palindrome number in c++

int n;
    int count =0;
    while(true){
        cin>> n;
        if (n == 0) return 0;
        
        if( n <= 10000){
        for( int i=1 ; i <= 2000000000; i++){

                if( palindrom(i) == true) {
                    count++;
                    //cout << "palindrom : " << i<< " count : " << count <<endl;
                
                
                    if( count == n ) {
                    
                        cout << i <<endl;
                   
                        count =0;
                        break;
                    }
Posted by: Guest on March-12-2020

Code answers related to "how to print nth palindrome number in c++"

Browse Popular Code Answers by Language