User Profile

Collapse

Profile Sidebar

Collapse
theinsider2012
theinsider2012
Last Activity: Nov 10 '07, 01:20 PM
Joined: Nov 6 '07
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • theinsider2012
    replied to Sums
    in Java
    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);
    	}
    }
    See more | Go to post

    Leave a comment:


  • theinsider2012
    started a topic Sums
    in Java

    Sums

    JAVA for Windows XP

    the question is:

    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...
    See more | Go to post
No activity results to display
Show More
Working...