C:\Users\ar114\Documents\NetBeansProjects\ProgrammingExam1_CalebFontenot\src\programmingexam1_calebfontenot\QuotientAndRemainderOfNumbersInAnyOrder.java |
package programmingexam1_calebfontenot;
import java.util.Scanner;
@author
public class QuotientAndRemainderOfNumbersInAnyOrder {
public static void main(String[] args) {
int number1, number2, quotient, remainder;
Scanner input = new Scanner(System.in);
System.out.print("Enter 2 variables and I will calculate the "
+ "quotient and the remainder: ");
number1 = input.nextInt();
number2 = input.nextInt();
if (number1 <= number2) {
System.out.println(number1 + " < " + number2 + "!");
int tmp = number2;
number2 = number1;
number1 = tmp;
}
quotient = number1 / number2;
remainder = number1 % number2;
System.out.println(number1 + " / " + number2 + " =");
System.out.println("The quotient is: " + quotient);
System.out.println("The remainder is: " + remainder);
}
}