- Joined
- Jul 2, 2019
- Posts
- 825
- Solutions
- 1
- Reaction
- 1,216
- Points
- 451
Attachments
-
You do not have permission to view the full content of this post. Log in or register now.
Last edited:
import java.util.Scanner;
public class sumOfArray {
public static void main(String[] freeallyoucanofficial) {
Scanner keyboardwarriors = new Scanner(System.in);
int hindiAkoTigaAdd = 0;
System.out.print("Enter how many numbers to process sum: ");
int walangNumero = keyboardwarriors.nextInt();
int[] hindiAkoArray = new int[walangNumero];
System.out.println("Enter the numbers");
for(int i = 0; i < walangNumero; i++) {
hindiAkoArray[i] = keyboardwarriors.nextInt();
hindiAkoTigaAdd += hindiAkoArray[i];
}
System.out.print("Sum of all numbers entered is: " + hindiAkoTigaAdd);
}
}
}
tenchuu po lodsswala pong for yung line 20. inayos ko na lang din po code mo. paki analyze nalang po kung ano inayos ko, sana pag aralan niyo rin po.
try this[Hidden content]
change class ArraySum to class Main
package Java;change class ArraySum to class Main
working sakin, gamit ko Eclipse as compiler and IDE. try ko sa console.package Java;
import java.util.Scanner;
class Main
{
public static void main(String[] args)
{
final int SIZE = 10;
int[] numbers = new int[SIZE];
Scanner console = new Scanner(System.in);
System.out.println("Enter "+ SIZE + " numbers: ");
for (int i = 0; i < SIZE; i++)
{
numbers = console.nextInt();
}
int sum = 0;
for(int i = 0; i < SIZE; i++)
{
sum += numbers;
}
System.out.println("Sum of numbers = " + sum);
}
}
ito new code ko idol ganon parin error nilang dalwa magkapariha lang ganito parin
Error: Could not find or load main class Main
- javac -cp . Main.java
- java -cp . Main
Caused by: java.lang.NoClassDefFoundError: Java/Main (wrong name: Main)
hello, ganto ginawa ko ganto rin gawin mo.working sakin, gamit ko Eclipse as compiler and IDE. try ko sa console.
oks na lods ty po ng maramiworking sakin, gamit ko Eclipse as compiler and IDE. try ko sa console.
hello, ganto ginawa ko ganto rin gawin mo.
rename "Main.java" to ArraySum.java
rename class Main to class ArraySum
execute this:
View attachment 1881628
- javac.exe -cp . ArraySum.java
- java.exe -cp . ArraySum.java
Goods napo ba ito?working sakin, gamit ko Eclipse as compiler and IDE. try ko sa console.
hello, ganto ginawa ko ganto rin gawin mo.
rename "Main.java" to ArraySum.java
rename class Main to class ArraySum
execute this:
View attachment 1881628
- javac.exe -cp . ArraySum.java
- java.exe -cp . ArraySum.java
try mo kung nagfufunction yung code mo properly. kung oo, goods na yanoks na lods ty po ng marami
Goods napo ba ito?
Programmer Po Kyo sir ,may pagawa sans ako pra sa scol Ng ansk ko, kahit magbaysd Po ako.programmers life.
keep it up ts.