Not passing all the test cases

what is the exact output format?

in two test cases it is first sum_odd then sum_even and in rest of them it’s vise versa.

hi @samikshagarg321_02590e2e7c8a8e95
refer

refer this code–>

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

    int pos = 1;
    int odd_sum = 0;
    int even_sum = 0;

    while(n > 0){
        int x = n%10;
        n = n/10;
        if(pos%2 == 1){
            odd_sum += x;
        }
        else{
            even_sum += x;
        }
        pos++;
    }
    cout<<odd_sum<<endl;
    cout<<even_sum<<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.