0

# can't solve this."n" numbers are given.Calculate the sum of the digits for every number & output the lowest number of these sums

I did a program, buy it isn't correct. I don't understand it that much so i can solve it.Please help. C++ https://code.sololearn.com/c7Mow0AqeHfY/?ref=app

8 ответов

+ 3

Do you want to keep the sums of the digits? I saw your question said about sort the sums in descending order.
I see you already understand how to sum the digits in each number. So tell me which part of this that you need help with? maybe I can try something to help you out.

+ 3

Okay give me a few minutes, I'll see what I can do ...

+ 2

Can you give me an example about what input and what output is supposed to be generated? I don't think I'm understanding your problem description clearly.

+ 1

Input
2-i want to use 2 numbrrs
335
455-these are the numbers
----
3+3+5=11
4+5+5=14
----
Output
335 is the lowest number

+ 1

I need to display the lowest sum in the form from the input, that's 335
The program has to calculate 3+3+5 , but display 335

+ 1

Well, finally done, take a look at this one, I use 2 arrays, one for the numbers, and another for sum of digits of each number. A sorting is also performed for the <sums> array. Hope this gives you an idea, and hopefully I got your explanation right.
https://code.sololearn.com/cUcnAEhrSSm1/?ref=app

+ 1

Thanks man.I apreciate that.I understand now

+ 1

Okay no problem : )
Don't hesitate to ask if there is any doubt, it's fine 👍