Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

What does this mean

Name: Anonymous 2008-12-09 0:02

Create a program that has the following fields & capabilities:

fields:

type     purpose
int     Storage for the target sum
methods

name     return type     purpose     parameter(s)
main    void    Gets the target sum from the user
and then calls getSeries.    none
getSeries     void     Determines the first and last integers in EVERY series of positive, consecutive INTEGERS whose sum is the target sum. Output sent to System.out object.     none


For example, if the target sum is 30, your program would output the following:
THE FIRST AND LAST NUMBERS IN EVERY SERIES OF POSITIVE, CONSECUTIVE INTEGERS WHOSE SUM IS 30 ARE:
4...8
6...9
9...11


I have no idea what im suppose to do. Does Anon know?

Name: Anonymous 2008-12-09 0:05

Does Anon know?
Yes.

Name: Anonymous 2008-12-09 0:12

Gasp...DO Tell anon!

Name: OP 2008-12-09 0:44

Oh, thanks, I figured that out. The program is now working as it should.

Grats.

Name: OP 2008-12-09 0:58

Nevermind I was retarded..Thread Continued..

Name: Anonymous 2008-12-09 1:05

import java.util.*;

public class srs {
    static int targetSum;
   
    public static void main(String[] args)
    {
        targetSum = 30;
        System.out.println("THE FIRST AND LAST NUMBERS IN EVERY SERIES OF POSITIVE," +
            " CONSECUTIVE INTEGERS WHOSE SUM IS " + targetSum + " ARE:");
        getSeries();
    }
   
    public static void getSeries()
    {
        for(int length = (int)Math.sqrt(targetSum); length > 0; length--)
            if (targetSum % length == (~length & 1) * (length / 2))
                System.out.println(""+
                    (targetSum * 2 / length - (length - 1)) / 2 + "..." +
                    (targetSum * 2 / length + (length - 1)) / 2);
    }

}

Name: Anonymous 2008-12-09 1:40

>>6
that could be written in one line in lisp

if you weren't such a faggot you'd know that

Name: Anonymous 2008-12-09 1:46

>>7
the question wasn't in lisp

if you weren't such a faggot you'd know that

Name: Anonymous 2008-12-09 1:57

Lisp is a faggots language...

Name: Anonymous 2008-12-09 2:28

>>9
At least it's not for rote learners.

Name: Anonymous 2008-12-09 3:48

i actually wanted to write it for you in c, without a compiler available but still just for fun

but i couldn't understand the description, tell ur teacher he sucks

Name: Anonymous 2008-12-09 8:57

>>11
without a compiler available
Install a real OS.

Name: Anonymous 2011-02-03 4:38

Name: Anonymous 2011-02-04 12:04

Don't change these.
Name: Email:
Entire Thread Thread List