a) Write a Java program to print the sum, multiplication and division of two numbers. Here two numbers are 50 and 5.
Answers
Answered by
1
Explanation:
to sum
import java.util.Scanner;
public class AddTwoNumbers {
public static void main(String args[]) {
Scanner input = null;
int a,b, sum;
try {
input = new Scanner(System.in);
System.out.print("50:");
a = Integer.parseInt(input.nextLine());
System.out.print("5:");
b = Integer.parseInt(input.nextLine());
sum = a + b ;
System.out.print("Sum =" + sum );
} catch(Exception e)
{
e.printStackTrace();
System.out.println("Error!");
}
finally
{
if (input != null) {
input.close();
}
}
}
}
Answered by
2
Answer:
This is a Java Program to Calculate the Sum, Multiplication, Division and Subtraction of Two Numbers.
Enter any two integers as input. Now choose from the given options to perform various operations on given integers.
Similar questions