in reply to How do I write a program that calculates the sum of all numbers to a number, n?
How silly. To calculate the numbers, you would use n(n+1)/2, no loop required. Maybe the loop is to ask for more input. :P
Anyway, it sounds like the requirements for this work are: get a command line argument, create a loop, and although not mentioned, print it out. It should be easy enough to write this program. Though, if you are having any difficulty, show us your work, and perhaps we can help. :)
|
|---|