Add Two Numbers
WAP to add two numbers. Take input from user.
import java.util.Scanner; class P03AddNumbers { public static void main() { int x, y, z; System.out.println("Enter two integers to calculate their sum"); Scanner in = new Scanner(System.in); x = in.nextInt(); y = in.nextInt(); z = x + y; System.out.println("Sum of the integers = " + z); } }
Comments
Post a Comment