Calculator
import java.util.Scanner;
public class Calculator {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int a1 = 1;
while (a1 == 1){
System.out.print("Enter 1st no: ");
float input1 = sc.nextFloat();
System.out.print("Enter the operation: ");
String input = sc.next();
System.out.print("Enter 2nd no: ");
float input2 = sc.nextFloat();
String a = new String("+");
String b = new String("-");
String c = new String("*");
String d = new String("/");
System.out.print("Result is: ");
if (input.equals(a)){
System.out.println(input1+input2);
}
else if (input.equals(b)){
System.out.println(input1-input2);
}
else if (input.equals(d)){
System.out.println(input1/input2);
}
else if (input.equals(c)){
System.out.println(input1*input2);
}
else {
System.out.println("Invalid operation");
}
System.out.println("");
}
}
}