I am trying to implement a basic calculation. The program take in 2 numbers, it works fine with 10 divided by 5 and give answer 2. If any smaller value divided by a larger value it will give me 0, can I have the answer in fraction?
Example 8 divided by 100 equal 8/100 rather than 0.
public class numtheory {
public static void main(String[] args) {
int n1;
int n2;
Scanner scan = new Scanner(System. in );
System.out.println("input number 1: ");
n1 = scan.nextInt();
System.out.println("input number 2: ");
n2 = scan.nextInt();
int temp1 = n1 / n2;
System.out.print("\n Output :\n");
System.out.print(temp1);
System.exit(0);
}
}