#Need to add up the numbers in my parameter
25 messages · Page 1 of 1 (latest)
⌛ This post has been reserved for your question.
Hey @stray coyote! Please use
/closeor theClose Postbutton above when you're finished. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
import java.util.Scanner;
public class Methods {
public static int summer (int[] args)
{
Scanner scan = new Scanner(System.in);
System.out.println("Type one number: ");
int a=scan.nextInt();
{
for(int b = 1; b < a ; b++)
System.out.println(b);
}
return a;
}
public static void upRev (String[] args)
{
}
}
thats my code atm
how do you loop over the numbers from 1 to the input
for(int b = 1; b < a ; b++)
yep
so now you need to put that in a variable
so you can remember what the previous value was
put what in a variable
this
do you know how to make variables
yea
yeah you just need that and then you add to that variable for each number
OH OK
💤 Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived.
If your question was not answered yet, feel free to re-open this post or create a new one.