# Are there any algorithms present in this program? Help is appreciated?

I don't know If there are any algorithms in my program below. If there are no algorithms in my program, how could I add algorithms to it?
// Print the operation that user is using AND print the answer (2 numbers)
if (numberFirst == 2) {
if (operation.equals("1"))
System.out.println("You...
show more
I don't know If there are any algorithms in my program below. If there are no algorithms in my program, how could I add algorithms to it?

// Print the operation that user is using AND print the answer (2 numbers)

if (numberFirst == 2) {

if (operation.equals("1"))

System.out.println("You are using addition." + " Your answer is " + (num1 + num2) + ".");

if (operation.equals("2"))

System.out.println("You are using subtraction." + " Your answer is " + (num1 - num2) + ".");

if (operation.equals("3"))

System.out.println("You are using multiplication." + " Your answer is " + (num1 * num2) + ".");

if (operation.equals("4"))

System.out.println("You are using division." + " Your answer is " + (num1 / num2) + ".");

if (operation.equals("5"))

System.out.println("You are using an exponent." + " Your answer is " + Math.pow(num1, num2) + ".");

}

// Print the operation that user is using AND print the answer (3 numbers)

if (numberFirst == 3) {

if (operation.equals("1"))

System.out.println("You are using addition." + " Your answer is " + (num1 + num2 + num3) + ".");

if (operation.equals("2"))

System.out.println("You are using subtraction." + " Your answer is " + (num1 - num2 - num3) + ".");

if (operation.equals("3"))

System.out.println("You are using multiplication." + " Your answer is " + (num1 * num2 * num3) + ".");

if (operation.equals("4"))

System.out.println("You are using division." + " Your answer is " + ((num1 / num2) / num3) + ".");

}

}

}

// Print the operation that user is using AND print the answer (2 numbers)

if (numberFirst == 2) {

if (operation.equals("1"))

System.out.println("You are using addition." + " Your answer is " + (num1 + num2) + ".");

if (operation.equals("2"))

System.out.println("You are using subtraction." + " Your answer is " + (num1 - num2) + ".");

if (operation.equals("3"))

System.out.println("You are using multiplication." + " Your answer is " + (num1 * num2) + ".");

if (operation.equals("4"))

System.out.println("You are using division." + " Your answer is " + (num1 / num2) + ".");

if (operation.equals("5"))

System.out.println("You are using an exponent." + " Your answer is " + Math.pow(num1, num2) + ".");

}

// Print the operation that user is using AND print the answer (3 numbers)

if (numberFirst == 3) {

if (operation.equals("1"))

System.out.println("You are using addition." + " Your answer is " + (num1 + num2 + num3) + ".");

if (operation.equals("2"))

System.out.println("You are using subtraction." + " Your answer is " + (num1 - num2 - num3) + ".");

if (operation.equals("3"))

System.out.println("You are using multiplication." + " Your answer is " + (num1 * num2 * num3) + ".");

if (operation.equals("4"))

System.out.println("You are using division." + " Your answer is " + ((num1 / num2) / num3) + ".");

}

}

}

Follow

2 answers
2

Are you sure you want to delete this answer?