generate functionMon, 07 Nov 2022

Full Java program to take user input and perform addition

import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(; int a, b, sum; System.out.println("Enter two integers to calculate their sum "); a = sc.nextInt(); b = sc.nextInt(); sc.close(); sum = a + b; System.out.println("Sum of the integers = " + sum); } }

Questions about programming?Chat with your personal AI assistant