Skip to content

Instantly share code, notes, and snippets.

@pepet96
Created December 2, 2013 00:55
Show Gist options
  • Save pepet96/7743196 to your computer and use it in GitHub Desktop.
Save pepet96/7743196 to your computer and use it in GitHub Desktop.
A & B
import java.util.Scanner;
import java.util.Arrays;
import java.io.*;
public class aandb {
public static void main (String [] args) throws IOException {
InputStreamReader inStream = new InputStreamReader(System.in);
BufferedReader systemIn = new BufferedReader(inStream);
String str = systemIn.readLine();
String[] str_array = str.split(" ");
String stra = str_array[0];
String strb = str_array[1];
int a = Integer.parseInt(stra);
int b = Integer.parseInt(strb);
if (1 <= a && b <= 50) {
int sum = a + b;
int subs = a - b;
int multi = a*b;
int quoti = a/b;
int mod = a%b;
System.out.println(sum);
System.out.println(subs);
System.out.println(multi);
System.out.println(quoti);
System.out.println(mod);
}
else if (1 > a && b > 50) {
System.out.println("not valid");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment