Skip to content

Commit

Permalink
java-practice-sum-need-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
rajjitlai committed Nov 24, 2024
1 parent 9d11c33 commit 37f9739
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
Binary file added Java/practice/Sum.class
Binary file not shown.
14 changes: 14 additions & 0 deletions Java/practice/Sum.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import java.util.Scanner;

public class Sum {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.print("Enter the numbers: ");
int sum = 0;
while (sc.hasNextInt()) {
int i = sc.nextInt();
sum += i;
}
System.out.println("Sum of the numbers: " + sum);
}
}

0 comments on commit 37f9739

Please sign in to comment.