Hi,
I have an assignment to do, I've been trying to do it, but I just can't find the right solution..
- What is it about?
- About an algorithm 1+2+3+4+...+n=t
(e.g.)
Input: 3, Outcome: 1+2+3=6
Input: 4,Outcome: 1+2+3+4=10
or
Input:10, Outcome: 1+2+3+4+5+6+7+8+9+10=55
It should only read numbers from 1 up to 999.
It should also contain code:
int i,n,s; n = //Input; i = 1; s = 1; System.out.println(1); while( i!=n ) { // WRITE YOUR CODE HERE! }
I am very, very new to java..
Could you either help me to do it or give me a hint?