#include
using namespace std;
int main() {
long long int n,b,c,sum=0;
cin>>n;
b=n;
while(n!=0)
{
c=n%10;
n=n/10;
sum+= ccc;
}
if(sum==b)
{
cout<<“true”;
}
else
{
cout<<“false”;
}
return 0;
}
What is wrong in this code . plz tell reason also
hello @Kunalgoyal
u should add c^(number of digits in ur given number) to the sum.
for example
if numbe is -> 12344 then u should calculate 1^5+2^5+3^5+4^5+4^5 . (5 because there are five digits in given number)