Program that sums as many numbers as user wants
Show older comments
I need to write a program that displays the sum of user-provided numbers. The user should be able to provide as many numbers as they like, and when they are done providing numbers, the sum of those numbers needs to be displayed. I am super confused on this so please help! Thanks
5 Comments
James Tursa
on 11 Feb 2021
What have you done so far? What specific problems are you having with your code? Do you know how to write a loop? Do you know how to use the input( ) function?
James Tursa
on 12 Feb 2021
What is the actual wording of the assignment? Are you required to ask a yes/no question and also get the user input? Or can you just keep asking the user for input until they enter a 0?
Why did you change your username and remove the question? Are you afraid of being accused of plagiarism? I recovered the removed content from the Google cache (something which anyone can do). Editing away your question is very rude. Someone spent time reading your question, understanding your issue, figuring out the solution, and writing an answer. Now you repay that kindness by ensuring that the next person with a similar question can't benefit from this answer. The current state of the page is also now archived.
Program that sums as many numbers as user wants
I need to write a program that displays the sum of user-provided numbers. The user should be able to provide as many numbers as they like, and when they are done providing numbers, the sum of those numbers needs to be displayed. I am super confused on this so please help! Thanks
Deleted comments:
OP on 11 Feb 2021
I honestly am not sure where to start. I know how to do loops and use input but I’m confused. Do I have to do two inputs, the first one asking if they want to select a number and the second what the number is? I was also trying to make it so if the user said yes to the first question that it would then ask the second one and go into a loop, but I kept getting a bunch of errors so I don’t think I’m doing it right. I’m not really sure how to set it up so if you could offer any help I would appreciate it
OP on 12 Feb 2021
"Write a program that displays the sum of user-provided numbers. The user should be able to provide as many numbers as they like, and when they are done providing numbers, the sum of those numbers needs to be displayed."
It doesn't specify, so I would assume I can do whatever is easiest. Thanks!
Walter Roberson
on 25 Mar 2022
In some jurisdictions you have the legal right to ask that certain publicly identifiable information about you not be publicly available. Your ability to change your username and remove profile information about your interests satisfies that legal right.
However, when you posted your Question, you agreed to the Terms and Conditions of the website... which gives Mathworks the right to retain the content .
Rik
on 25 Mar 2022
You not only changed your profile picture and username (and perhaps also removed other information from your profile), but you also edit away your question. I had to manually reverse that and now you're suggesting you had every right to do so, just because you wanted to keep private information private. That is the problem.
Accepted Answer
More Answers (0)
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!