-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCalcul.java
24 lines (23 loc) · 949 Bytes
/
Calcul.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
public class Calcul {
public static void main(String[] args)
{
char operateur=args[1].charAt(0);
int resultat;
switch (operateur)
{
case '+' :resultat=(Integer.parseInt(args[0])) + (Integer.parseInt(args[2]));
System.out.println(+resultat);
break;
case '-' :resultat=(Integer.parseInt(args[0])) - (Integer.parseInt(args[2]));
System.out.println(+resultat);
break;
case '/' :resultat=(Integer.parseInt(args[0])) / (Integer.parseInt(args[2]));
System.out.println(+resultat);
break;
case '*' :resultat=(Integer.parseInt(args[0])) * (Integer.parseInt(args[2]));
System.out.println(+resultat);
break;
// default :System.out.println("erreur");
}
}
}