import TerminalIO.KeyboardReader;
public class Quotient{
public static void main(String [] args){
KeyboardReader reader = new KeyboardReader();
int num1; // number 1
int num2; // number 2
int ans; // answer
int rem; // remainder
System.out.println("Please enter the first number: ");
num1 = reader.readInt;
System.out.println("Please enter the second number: ");
num2 = reader.readInt;
if(num1>num2){ // Compare the numbers to find the larger.
ans=num1/num2; // divide the larger to find quotient.
rem=num1%num2; // divide the larger via modulus to find remainder.
System.out.println(ans+"r. "+rem);
}
else{ // If num1 < num2.
ans=num2/num1;
rem=num2%num1;
System.out.println(ans+"r. "+rem);
}
}
}
DOing this stuff for school in notepad to lazy to install jdk and jvm and yadda yadda so if it works, or could use some doctoring much appreciated, I have a couple more I want to post.
-----------------This post was merged together. In future use the edit button.-----------------
import TerminalIO.KeyboardReader;
public class RightTriangle{
public static void main(String [] args){
KeyboardReader reader = new KeyboardReader();
int side1;
int side2;
int side3;
double total1;
double total2;
double total3;
System.out.println("Enter a side: "); //
side1 = reader.readInt; // read in side1
System.out.println("Enter second side: "); //
side2 = reader.readInt; // read in side2
System.out.println("Enter third side: "); //
side3 = reader.readInt; // read in side3
if(side1>side2){ // if side 1 is largest
if(side1>side3){
total1=Math.pow(side2,2)+Math.pow(side3,2);
if(total1==Math.pow(side1,2)){
System.out.println("This is a right triangle"); // as it satisfies Pythagoreum.
}
else{
System.out.println("This is NOT a right triangle");
}
}
}
if(side2>side3){ // if side 2 is largest
if(side2>side1){
total2=Math.pow(side1,2)+Math.pow(side3,2);
if(total2==Math.pow(side2,2)){
System.out.println("This is a right triangle"); // as it satisfies Pythagoreum.
}
else{
System.out.println("This is NOT a right triangle");
}
}
}
if(side3>side2){ // if side 3 is largest
if(side3>side1){
total3=Math.pow(side2,2)+Math.pow(side1,2);
if(total3==Math.pow(side3,2)){
System.out.println("This is a right triangle"); // as it satisfies Pythagoreum.
}
else{
System.out.println("This is NOT a right triangle");
}
}
}
}
}