Biblioteca Java - Rev 4
Subversion Repositories:
package introducere.java;
import java.io.*;
public class CitireTastatura {
public static void main(String[] args) throws Exception{
BufferedReader t = new BufferedReader(new InputStreamReader(System.in));
String x = t.readLine();
String y = t.readLine();
String o = t.readLine();
int a = Integer.parseInt(x);
int b = Integer.parseInt(y);
if(o.equals("+")){
int r = a+b;
System.out.println("Rezultat="+r);
}else if(o.equals("-")){
int r = a-b;
System.out.println("Rezultat="+r);
}else
System.out.println("Operatie necunoscuta!");
System.out.println("SFARSIT!");
}
}
import java.io.*;
public class CitireTastatura {
public static void main(String[] args) throws Exception{
BufferedReader t = new BufferedReader(new InputStreamReader(System.in));
String x = t.readLine();
String y = t.readLine();
String o = t.readLine();
int a = Integer.parseInt(x);
int b = Integer.parseInt(y);
if(o.equals("+")){
int r = a+b;
System.out.println("Rezultat="+r);
}else if(o.equals("-")){
int r = a-b;
System.out.println("Rezultat="+r);
}else
System.out.println("Operatie necunoscuta!");
System.out.println("SFARSIT!");
}
}