Sum of odd even places

#include
using namespace std;

int main(){
int num;
cin>>num;
int sumodd=0;
int sumeven=0;
int a,b;
int snum=num/10;
while(num>0){
a=num%10;
sumodd=sumodd+a;
num=num/100;

}
while(snum>0){
	b=snum%10;
	sumeven=sumeven+a;
	snum=snum/100;

}
cout<<sumeven<<endl;
cout<<sumodd<<endl;
return 0;

}
// what is wrong in this code?

hi @srivastavaayush1611_3fd51b257da0b834 add b in sumeven not a, and print sumodd first

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.