WILLIAM S.
asked 02/08/21Divide input integers
Write a program using integers userNum and divNum as input, and output userNum divided by divNum three times.
Ex: If the input is:
the output is:
Note: In Java, integer division discards fractions. Ex: 6 / 4 is 1 (the 0.5 is discarded).
1 Expert Answer

Ariel K. answered 03/03/21
Patient and Experienced Computer Science Tutor
You can use a simple for loop to do this:
Still looking for help? Get the right answer, fast.
Get a free answer to a quick problem.
Most questions answered within 4 hours.
OR
Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.
Sebastion H.
public class LabProgram { public static void main(String[] args) { Scanner scnr = new Scanner(System.in); int userNum; int divNum; userNum = scnr.nextInt(); divNum = scnr.nextInt(); System.out.print((userNum/divNum) + " " ); System.out.print(((userNum/divNum)/divNum) + " " ); System.out.println((((userNum/divNum)/divNum)/divNum) + " " );09/08/21