1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
statuscvo [17]
4 years ago
14

Write a program using integers userNum and x as input, and output userNum divided by x four times. Ex: If the input is 2000 2, t

he output is: 1000 500 250 125 Note: In Coral, integer division discards fractions. Ex: 6 / 4 is 1 (the 0.5 is discarded).
Computers and Technology
1 answer:
BaLLatris [955]4 years ago
5 0

Answer:

import java.util.Scanner;

public class Division {

   public static void main(String[] args) {

    Scanner in = new Scanner(System.in);

       System.out.println("Enter an integer");

       int userNum = in.nextInt();

       System.out.println("Enter the divisor");

       int x = in.nextInt();

           int first = userNum/x;

           int second = first/x;

           int third = second/x;

           int fourth = third/x;

       System.out.println(first+" "+second+" "+third+" "+fourth);

   }

}

Explanation:

  • In Java programming langauge use the scanner class to receive the values from the user (userNum and x)
  • Carryout integer division of userNum/x to obtain the first number
  • Repeat the sam step to obtain the second, third and fourth number
  • Output the numbers to the user
You might be interested in
A(n) __________ is a common list operation used in programming. Its purpose is to iterate through a list of items, one item at a
34kurt
Linear search

You implement this algorithm by iterating over each item, and checking if the item matches what you are searching for.

It is linear because it takes a linear amount of time to search for an item.
5 0
3 years ago
Why is it difficult to detect a Trojan horse?
marishachu [46]

Answer:

Explanation:

Because the virus disguises it self as something you are trying to download, then it attackes your device

8 0
3 years ago
Read 2 more answers
The database structure in a dbms is stored as a _____.
Colt1911 [192]
This will be stored as a collection of files
6 0
3 years ago
Where is Peru located?
Illusion [34]
B. South America

[ignore:20 CHARACTERS]
4 0
3 years ago
The recelver in a communication exchange can always ellminate all barriers to the communication.
gogolik [260]
It’s false because I know it
3 0
3 years ago
Other questions:
  • Your computer is crashing on a regular basis. Which of the following is an operation available to the user that should help rese
    6·2 answers
  • Summarize who you believe cyber criminals are, and why?
    8·1 answer
  • Universal Containers is tracking the interviewer's ratings of candidate in Salesforce. They would like to easily link the Candid
    5·1 answer
  • Above all, you want to implement the cheapest CRM system available. You are willing to accept any risks associated with this, so
    11·1 answer
  • How to control what is on the x and y axis in excel?
    13·1 answer
  • Where does the list of incoming mail appear in gmail
    13·2 answers
  • If you entered data into row 4 and it should be in row 3, you should _____.
    8·2 answers
  • While developing a network application, a programmer adds functionally that allows her to access the running program without aut
    14·1 answer
  • Which is a benefit of peer-to-peer networking?
    12·1 answer
  • I will mark you as brainlist
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!