Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions sum.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@ public class SumOfNumbers2
{
public static void main(String args[])
{
int x, y, sum;
int x, y, sum, z;
Scanner sc = new Scanner(System.in);
System.out.print("Enter the first number: ");
x = sc.nextInt();
System.out.print("Enter the second number: ");
y = sc.nextInt();
y = sc.nextInt();
z= sc.nextInt():
sum = sum(x, y);
System.out.println("The sum of two numbers x and y is: " + sum);
}
System.out.println("The sum of two number x and y is: " + sum);
}
//method that calculates the sum
public static int sum(int a, int b)
{
Expand Down