diff --git a/Java-calculator/Sum.java b/Java-calculator/Sum.java index 374fa35..8af7fb0 100644 --- a/Java-calculator/Sum.java +++ b/Java-calculator/Sum.java @@ -1,14 +1,20 @@ import java.util.Scanner; public class Sum { - public static void main(String[]args) - { - Scanner sc=new Scanner(System.in); +static void add() + { + Scanner sc=new Scanner(System.in); System.out.println("enter first number: "); int num1=sc.nextInt(); System.out.println("enter second number: "); int num2=sc.nextInt(); int Total=num1+num2; System.out.println("the sum of "+num1+" and "+num2+" is "+Total); + + } + public static void main(String[]args) + { + Sum.add(); + } }