Skip to content

Commit 6a4f918

Browse files
committed
feat: Implement basic sum calculator with repeated user input
🧠 Logic: - Used `Scanner` to take integer input from the user. - Reads two numbers (`num1` and `num2`) multiple times and prints their sum. - Each block prompts for inputs separately and outputs `"The sum = X"`. - Simple demonstration of `Scanner.nextInt()` and arithmetic operations. 🔑 Key: - Demonstrates input handling, addition, and console output**. - Code currently repeats input/output blocks explicitly (no loop yet). Signed-off-by: Somesh diwan <[email protected]>
1 parent a367974 commit 6a4f918

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Section10Methods/Methods 2.O/src/Main.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
public class Main {
44

55
public static void main(String[] args) {
6-
// Q: take input of 2 numbers and print the sum
6+
// Q: take input of 2 numbers and print the sum.
77
Scanner in = new Scanner(System.in);
88
System.out.println("Enter ur numbers: ");
99
int num1, num2, sum;

0 commit comments

Comments
 (0)