Print reverse 123456789->987654321

It will be print in reverse manner from array or string

hi @kumarakash121005
code for reverse of a number -->

#include <iostream>
using namespace std;
int main() {
    int n;
    cin>>n;

    int rev_no = 0;
    while(n > 0){
        int rem = n % 10;
        n = n / 10;
        rev_no = rev_no * 10 + rem;
    }
    cout<<rev_no<<endl;
}

code for count digits -->

#include <iostream>
using namespace std;
int main() {
    int n;
    cin>>n;
    int digit;
    cin>>digit;

    int cnt = 0;
    while(n > 0){
        int rem = n % 10;
        n = n / 10;
        if(rem == digit){
            cnt++;
        }
    }
    cout<<cnt<<endl;
}

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.