Please tell the corrections

hi @sbhardwaj1be21_2a991b329433c059, refer

#include<bits/stdc++.h>
using namespace std;

int main(){
    int num,temp,n=0,check=0;
    cin>>num;
    temp=num;
    while(temp){
        n++;
        temp=temp/10;
    }

    temp=num;

    while(temp){
        int remainder=temp%10;
        temp=temp/10;
        int toadd=1;
        for(int i=0;i<n;i++){
            toadd*=remainder;
        }
        check+=toadd;
    }

    if(check==num){
        cout<<"true"<<endl;
    }
    else{
        cout<<"false"<<endl;
    }
    return 0;
}

i got 2 testcases wrong with the above code…can u pleaase guide me in the same code

hi @sbhardwaj1be21_2a991b329433c059 u r doing power of r till 3 only for all nos, it should the power till no of digits not 3 everytime

https://ide.codingblocks.com/s/671081 it is still not passing the testcases…can u make the corrections in the code instead

@sbhardwaj1be21_2a991b329433c059 refer the code i sent