hi ! I want to sum of digts on C++ but when get the nagative number give me the result if pastive number like when u write -98 answer u 17 not -17


using namespace std;

int main(){
    int N=0 ;
    int sum=0;

            sum += (N%10);
        N = N / 10;
    cout << sum << endl;


Multiply by -1 if the number is negative. Use an if statement.

How do I do that "ddanbe" when I used the while?

Use the if/else statement after completing the while loop.