Code not returning true or false but compiling successfully

https://ide.codingblocks.com/s/48693

hey Kunj, you code need some changes

  1. your function return type is bool so you have to do cout<<armstrong(n);
  2. it will always give you output 0 as value to n is changed and at last value of n is 0. mane another variable k and assign its value n. then compare sum==k

https://ide.codingblocks.com/s/48705
i have done the changes but now it is returning 0 and 1.
what to do for true and false.

instead of making bool function, make a void/int function and then cout<<“true” or “false”.

Hey Kunj, modify your main function as shown in this code snippet

int main(){
    int n;
    cin>>n;
     if(armstrong(n))
         cout<<"true"<<endl;
     else 
        cout<<"false"<<endl;
}