Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main(){
- int num,conta=0,separat1=0,separat2=0;
- cin>>num;
- int aux=num;
- if(num!=0){
- while(aux!=0){
- aux/=10;
- ++conta;
- }
- }
- else cout<<"res"<<endl;
- if(conta%2==0 && num!=0){
- int aux2,reduir=num;
- for(int i=0;i<(conta/2);++i){
- aux2=reduir;
- aux2%=10;
- reduir/=10;
- separat2=separat2+aux2;
- }
- for(int i=0;i<(conta/2);++i){
- aux2=reduir;
- aux2%=10;
- reduir/=10;
- separat1+=aux2;
- }
- if(separat1>separat2) cout<<separat1<<" > "<<separat2<<endl;
- else if(separat1<separat2) cout<<separat1<<" < "<<separat2<<endl;
- else cout<<separat1<<" = "<<separat2<<endl;
- }
- else if (conta%2==1) cout<<"res"<<endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement