import java.util.Scanner; public class Main{ public static void main(String[] args) { int ans = sum2(); System.out.println("Your Answer = "+ans); } static int sum2(){ Scanner in = new Scanner(System.in); System.out.print("Enter Number 1 : "); int num1 = in.nextInt(); System.out.print("Enter Number 2 : "); int num2 = in.nextInt(); int sum = num1+num2; return sum; } }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter