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]
3 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]3 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
write a pseudo code and flow chart that take a number as input and prints multiplication table up to 10
Troyanec [42]

PSEUDOCODE:

1. DECLARE number: INTEGER

2. DECLARE multiple: INTEGER

3. INPUT number  

4. FOR counter FROM 1 TO 10 DO

5.     multiple <-- number * counter

6.     PRINT number, " * ", counter, " = ", multiple

7. ENDFOR


<em>1. declaring a variable "number" as an Integer</em>

<em>2. declaring a variable "multiple" as an Integer</em>

<em>3. The user inputs the value of number</em>

<em>4. FOR loop where variable "counter" increments by 1 after every iteration</em>

<em>5. sets the value for variable "multiple" as the value of number * counter</em>

<em>6. prints out for example "3 * 1 = 3" and will continue till counter reaches 10</em>

<em>7. Ends the for loop</em>

FLOWCHART below

hope it helped

8 0
3 years ago
The incandescent test lamp is used to check for the presence of
Arisa [49]
Http://americanhistory.si.edu/collections/search/object/nmah_995750
4 0
2 years ago
In this lab, you complete a prewritten Python program for a carpenter who creates personalized house signs. The program is suppo
ivolga24 [154]

Using the computer language in python to write a function code that personalized house signs

<h3>Writting the code in python:</h3>

<em>#Assign varibles</em>

<em>charge = 0.00</em>

<em>numChars = 8</em>

<em>color = "gold"</em>

<em>woodType = "oak"</em>

<em />

<em>#Checking for number of characters</em>

<em>if numChars > 5:</em>

<em>charge = 35 + (numChars-5)*4</em>

<em>elif numChars > 0:</em>

<em>charge = 35</em>

<em />

<em>#Checking wood type</em>

<em>if woodType == "oak":</em>

<em>charge += 20</em>

<em />

<em>#Checking for color</em>

<em>if color == "gold":</em>

<em>charge += 15</em>

<em />

<em>#Print output</em>

<em>print("The charge for this sign is $"+str(charge)+".")</em>

See more about python at brainly.com/question/13437928

#SPJ1

5 0
1 year ago
NEED HELP ASAP! BRAINLIEST AND 20 PTS TO CORRECT ANSWER!
son4ous [18]

The correct answer is C.

8 0
3 years ago
email communication has its own set of etiquette guildelines for users to follow if they want to be effectove communicators. whi
Len [333]
Effective not effectove. These are guidelines:
Be brief.
Have a short opening sentence or paragraph that puts the matter in context.
Use the middle paragraph(s) to cover the matter(s) in hand.
Close with a clear agreement of what will be done, by whom, and by when.
7 0
3 years ago
Other questions:
  • By default, windows does not display ____________________ in windows explorer.
    8·1 answer
  • The ____ command creates a subdirectory under a directory. rd md cd ad
    11·1 answer
  • The continue statement _________.
    11·1 answer
  • What is the specifications, number of sales, positive and negative points and a few popular games of the first PlayStation?
    13·1 answer
  • Hi whats airpods good for
    15·2 answers
  • The cafeteria offers a discount card for sale that entitles you, during a certain period, to a free meal whenever you have bough
    13·1 answer
  • What do you mean by Graphics editing​
    14·1 answer
  • Explain briefly the use of the computers in the advertising area​
    11·1 answer
  • Sara wants to set up her lights to turn on when she arrives home. She has heard that she might be able to do this using IoT. Wha
    12·2 answers
  • What is the difference between referential and entity integrity
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!