1) Write an algorithm for calling sub function add sub div mul. Write one main function program for calling addition and multiplication
Answers
Answer:
import java.util.Scanner;
public class JavaProgram
{
public static void main(String args[])
{
int first, second, add, subtract, multiply;
float devide;
Scanner scanner = new Scanner(System.in);
System.out.print("Enter Two Numbers : ");
first = scanner.nextInt();
second = scanner.nextInt();
add = first + second;
subtract = first - second;
multiply = first * second;
devide = (float) first / second;
System.out.println("Sum = " + add);
System.out.println("Difference = " + subtract);
System.out.println("Multiplication = " + multiply);
System.out.println("Division = " + devide);
}
}
output of program
Enter Two Numbers : 12
5
Sum = 17
Difference = 7
Multiplication = 60
Division = 2.4
Hope it helps you and is made from java programming language