Well like I said, the only code I have is for the app that sums from 1 to 50. So here it is.
Code:
public class Sum50
{
public static void main(String[] args)
{
int start = 0;
int sum = 0;
while (start < 50)
{
++start;
sum = sum + start;
}
System.out.println("The sum of 1 to 50 is " + sum);
}
}
Write an application that shows the sum of 1 to n for every n from 1 to 50. That is, the program prints 1 (the sum of 1 alone), 3 (the sum of 1 and 2), 6 (the sum of 1, 2, and 3), and so on.
I'm not looking for a answer, just some ideas on where to start. I was able to create an application that sums the integers from 1 to 50 and displays the answer 1275, but I'm...
Leave a comment: