I've coded your problem and I will list the steps I took so you can program it.
note that type conversions may be needed.
1. you read the number into a variable
2a. make a loop
2b. in the loop...
Type: Posts; User: Stayawake
I've coded your problem and I will list the steps I took so you can program it.
note that type conversions may be needed.
1. you read the number into a variable
2a. make a loop
2b. in the loop...
To read an integer you should use .readInt.. There are different methods for each datatype..
For a string = readline
For a integer = readInt
And so on..
Hope this helps
If given a input which contains an upperbound, you could something along the lines like this:
Int UpperBound = input
Int Sum
For(int i; i < UpperBound; i++){
Sum += i
}
Do you have to give your new filter() a value? I mean, how does java know what you want to filter if you just say myfilter..