I have like 3 hours trying to solve this simple problem. Here is what I am trying to accomplished: Ask the user to enter a number, and then add those numbers. If the users enters five numbers, then I should add five numbers.
Any help will be appreciated.
import java.util.Scanner; public class loopingnumbersusingwhile { public static void main(String args[]) { Scanner kb = new Scanner(System.in); int input; System.out.println("How Many Numbers You Want To Enter"); total = kb.nextInt(); while(input <= kb.nextInt()) { input++; System.out.println("How Many Numbers You Want To Enter" + input); int input = kb.nextInt(); } } }