Skip to content

Commit 270c1f7

Browse files
committed
feat: Add ReadingFromKeyBoard class to read integers and compute their sum
Add a program that: - Uses `Scanner` to read two integers from user input - Computes and prints their sum - Demonstrates basic input handling and arithmetic operations in Java.
1 parent 5bd6b12 commit 270c1f7

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

Section5OperatorExpression/src/ReadingFromKeyBoard.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@
22
import java.util.*;
33

44
public class ReadingFromKeyBoard {
5-
public static void main(String args[])
6-
{
5+
public static void main(String args[]) {
76
Scanner s = new Scanner(System.in);
87
int a, b, c;
9-
System.out.print("Enter 2 number");
8+
System.out.print("Enter 2 number: ");
9+
1010
a = s.nextInt();
1111
b = s.nextInt();
1212
c = a+b;
13-
System.out.println("Sum of two number is"+ c);
13+
14+
System.out.println("Sum of two number is: "+ c);
1415
}
15-
}
16+
}

0 commit comments

Comments
 (0)