Failing in one test case in armstrong number

#include
#include
using namespace std;
bool arm(int n)
{
int s=0,sum=0;
int ch=n;
while(true)
{if(sum==ch) return true;
if(n<=0)
{
n=ch;
sum=0;
s=s+1;
}
if(sum>ch) return false;
if(sum<ch) sum =sum+pow(n%10,s);
n=n/10;
}
}
int main()
{
int n;cin>>n;
if(arm(n)) cout<<“yes”;
else cout<<“no”;
}