reset password
Author Message
jbonil34
Posts: 10
Posted 19:07 May 05, 2016 |

Hey guys,

So I got to separate the numbers, but I'm still having trouble with adding them up. I tried doing something like variable++, variable being the numbers in my code, but it won't work and I'm trying to think of something like assigning the numbers to variables and then adding them. The only problem is that I wouldn't know how many numbers the user would input. Can you guys help? Thanks in advance

jdonosa
Posts: 3
Posted 20:06 May 05, 2016 |

You should be checking the number you enter digit by digit, you would then assign each digit to a variable to hold it and then add that variable to your sum.

rcamach7
Posts: 31
Posted 21:10 May 05, 2016 |

While you separate and convert each number string to a digit find a way to sum them as your code loops around. You need this code inside your loop too, it's should separate then add afterwards.

 

btw, I don't believe there is a way to have your program make new variables but you don't need that anyways.

Last edited by rcamach7 at 21:14 May 05, 2016.