diff --git a/Java/practice/Sum.class b/Java/practice/Sum.class new file mode 100644 index 0000000..9d43d79 Binary files /dev/null and b/Java/practice/Sum.class differ diff --git a/Java/practice/Sum.java b/Java/practice/Sum.java new file mode 100644 index 0000000..dc22800 --- /dev/null +++ b/Java/practice/Sum.java @@ -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); + } +}