Question: Help, WITHOUT using arrays, please help me get my program to work. I will rate you 5 stars and the best!. I need to write
Help, WITHOUT using arrays, please help me get my program to work. I will rate you 5 stars and the best!. I need to write a java program that the user can input numbers, and then outputs the individual numbers and the sum of all numbers added together (8 0 5 sum 13). I am getting an error at the limit = console.nextInt(); saying ----jGRASP exec: javac -g InputSum.java InputSum.java:21: error: cannot find symbol limit = console.nextInt(); ^ symbol: variable console location: class InputSum InputSum.java:28: error: cannot find symbol number = console.nextInt(); ^ symbol: variable console location: class InputSum 2 errors
Below is my program
import java.util.*;
public class InputSum { //main method public static void main(String [] args) { int limit; int number; int sum = 0; int counter = 0; System.out.print("Please input the number of "+" integers "); limit = console.nextInt(); System.out.printf("Enter your %d "+" numbers :", limit); while (counter < limit) { number = console.nextInt(); sum = sum + number; counter++; } System.out.println("Your entered numbers"); System.out.printf("The sum of %d "+" numbers = %d", limit, sum); } }
Please help me get a working program.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
