IS ARMSTRONG NUMBER

What is the problem with this code? It is giving timelimit exceeded (wall time): aborting command error. Please help.

#include
#include
using namespace std;
int main()
{
int num;
cin>>num;
int a=0,i,k,sum=0;
for(i=num; i!=0; i/10)
{
a++;
}
for(k=num; k!=0; k/10)
{
int b=k%10;
sum+=pow(b, a);
}
cout<<sum;
return 0;
}

hi @parwalprashansa_dc63e1668bcf7cbc

in your second for loop you haven’t changed the value of k , you just did k/10.
Instead write k /= 10 . so your code goes like :
for(k=num; k!=0; k=k/10)
{
int b=k%10;
sum+=pow(b, a);
}