Im very new at java and this is the last thing i have to finish before get some sleep. I just cant seem to finish the program. The goal is to make a program where the user inputs a number, then recieves the limit, range and sum of the odd numbers that make up the entered number. I have most of it done, i just cant seem to get the program to print the total sum of the odd numbers
import java.util.Scanner; class Sumoddjkunitz { public static void main(String[] args) { int user1, div; //This tells the user what to do System.out.println("This program will tell you the sum, limit, and range of odd numbers between 1 and your chosen number"); System.out.println("Please enter the limit number"); Scanner keyboard = new Scanner(System.in); user1 = keyboard.nextInt(); //spacer below System.out.println(" "); //limit System.out.print("The Limit of the numbers is "); System.out.print(user1); //spacer below System.out.println(" "); //range System.out.print("The range of the numbers is "); System.out.print("1 to "); System.out.print(user1); //spacer below System.out.println(" "); //sum of odd numbers and loop System.out.print("The sum of the numbers is "); sum = 0; for (int j = 1; j <= user1; j++) { if (j % 2 == 1) { sum += i; } } } }