calcJ
an anonymous user
·
Java
import java.util.*;
import java.lang.*;
import java.io.*;
public class Main {
public static void main(String[] args) {
System.out.println(calcolatrice(5, 2, "*"));
}
public static int calcolatrice(int a, int b, String op){
int ris = 0;
switch(op){
case "+":
ris = a+b;
break;
case "-":
ris = a-b;
break;
case "*":
ris = a*b;
break;
case "/":
ris = a/b;}
return ris;
}
}
Output
Embed on website
To embed this program on your website, copy the following code and paste it into your website's HTML:
Comments
This comment belongs to a banned user and is only visible to admins.
This comment belongs to a deleted user and is only visible to admins.