i have here the code its suppose to ask user for how many numbers they want to e
ID: 3646409 • Letter: I
Question
i have here the code its suppose to ask user for how many numbers they want to enter and then lets them enter it but the problem I'm facing is after it ask me how many numbers i want to enter it takes that then when i enter the first number it doesn't do anything so i have to enter another number then it ask for next number and so on this was based on enter 3 for how many numbers you want to enter. but then once it takes all the number entered for ex. i chose 3 numbers , 3,2,3 = 8 it would give me sum of the last 2 numbers onlyExplanation / Answer
import java.io.*; import java.util.*; class Sumprog { public static void main(String args[]) { Scanner scanner=new Scanner(System.in); int n; int sum=0; System.out.println("Enter size"); n=scanner.nextInt(); int k[]=new int[n]; for(int i=0;iRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.