Skip to content

Commit 87e630f

Browse files
Merge pull request #241 from prathameshviralekar/patch-1
Create Add two number with user input
2 parents 3bd5cc8 + cd4ecee commit 87e630f

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

Add two number with user input

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import java.util.Scanner;
2+
3+
class MyClass {
4+
public static void main(String[] args) {
5+
int x, y, sum;
6+
Scanner myObj = new Scanner(System.in);
7+
System.out.println("Type a number:");
8+
x = myObj.nextInt();
9+
10+
System.out.println("Type another number:");
11+
y = myObj.nextInt();
12+
13+
sum = x + y; // Calculate the sum of x + y
14+
System.out.println("Sum is: " + sum);
15+
}
16+
}

0 commit comments

Comments
 (0)