Computer Science, asked by yaahsharma68, 1 month ago

Write a Java program for addition of two number. [Parameterised Input].​

Answers

Answered by RROBROY
5

Answer:

Sum of Two Numbers Using Command Line Arguments in Java

public class SumOfNumbers4.

{

public static void main(String args[])

{

int x = Integer.parseInt(args[0]); //first arguments.

int y = Integer.parseInt(args[1]); //second arguments.

int sum = x + y;

System.out.println("The sum of x and y is: " +sum);

Answered by navdeepbawa9
1

Answer:

import java.util.Scanner;

public class IntegerSumExample2 {

public static void main(String[] args) {

System. out. println("Enter the Two numbers for addtion: ");

Scanner readInput = new Scanner(System.in);

int a = readInput. nextInt();

int b = readInput. nextInt();

readInput. close();

Similar questions