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
denis23 [38]
3 years ago
4

LAB: Divide input integers

Computers and Technology
1 answer:
Brums [2.3K]3 years ago
7 0
Mark Brainliest please


Answer:
# The user is prompted to enter number as dividend
# The received number is assigned to userNum
userNum = int(input("Enter the number you want to divide: "))
# The user is prompted to enter number as divisor
# The divisor is assigned to x
x = int(input("Enter the number of times to divide: "))
# divideNumber function is defined to do the division
def divideNumber(userNum, x):
# counter is declared to control the loop
counter = 1
# the while-loop loop 3 times
# the division is done 3 times
while counter <= 3:
# integer division is done
# truncating the remainder part
userNum = userNum // x
# the result of the division is printed
print(userNum, end=" ")
# the counter is incremented
counter += 1
# the divideNumber function is called
# the received input is passed as parameter
# to the function
divideNumber(userNum, x)
# empty line is printed
print("\n")
Explanation:
The // operator in python works like the / operator in C. The // operator returns only the integer part of division operation. For instance 6 // 4 = 1. The fraction part is discarded
You might be interested in
How many bits strings of length 12 contain (8 pts)? a. exactly three 1s? b. at most three 1s? c. at least three 1s? d. an equal
Irina-Kira [14]

1. Exactly three 1 s?

$$\left(\begin{array}{c}12 \\3\end{array}\right)=220$$

2. At most three$1 \mathrm{~s}$ ?

$$\left(\begin{array}{c}12 \\0\end{array}\right)+\left(\begin{array}{c}12 \\1\end{array}\right)+\left(\begin{array}{c}12 \\2\end{array}\right)+\left(\begin{array}{c}12 \\3\end{array}\right)=1+12+66+220=299 \text {. }$$

3. At least three 1 s?

Take a shortcut by using the previous answer:$2^{12}-66-12-1=4017$

4. An equal number of$0 \mathrm{~s}$ and $1 \mathrm{~s}$ ?

$$\left(\begin{array}{c}12 \\6\end{array}\right)=924$$

<h3>What is strings ?</h3>

The C programming language includes a set of functions executing operations on strings in its standard library. Different operations, such as copying, concatenation, tokenization, and searching are supported.

In C programming, a string exists as a sequence of characters terminated with a null character \0. For example char c[] = "c string"; When the compiler discovers a sequence of characters enclosed in the double quotation marks, it appends a null character \0 at the end by default. The C language does not have a distinctive "String" data type, the way some other languages such as C++ and Java do. Instead, C stores strings of characters as arrays of chars, completed by a null byte.

1. Exactly three 1 s?

$$\left(\begin{array}{c}12 \\3\end{array}\right)=220$$

2. At most three$1 \mathrm{~s}$ ?

$$\left(\begin{array}{c}12 \\0\end{array}\right)+\left(\begin{array}{c}12 \\1\end{array}\right)+\left(\begin{array}{c}12 \\2\end{array}\right)+\left(\begin{array}{c}12 \\3\end{array}\right)=1+12+66+220=299 \text {. }$$

3. At least three 1 s?

Take a shortcut by using the previous answer:$2^{12}-66-12-1=4017$

4. An equal number of$0 \mathrm{~s}$ and $1 \mathrm{~s}$ ?

$$\left(\begin{array}{c}12 \\6\end{array}\right)=924$$

To learn more about strings refer to:

brainly.com/question/27251062

#SPJ4

3 0
2 years ago
In a _____ feedback loop, output that results from a system acts as input that moves the system in the other direction.In a ____
Svetach [21]

Answer: Negative

Explanation: A negative feedback loop has the major property of regulating on its own. It also becomes stable at certain point of time which makes it balancing feedback.The increment in the output of this system prevents the future generation of the feedback system.

The output gained as feedback is meant as the input in opposite direction in this system.Other options are incorrect because inverted feedback loop works in the inverted manner, positive feedback loop behaves as unstable system and convoluted feedback loop is not a technical term.

8 0
3 years ago
If you are upgrading your operating system to Windows 7, you may not use the In-Place Upgrade Installation Option with
son4ous [18]
Windows Vista Premium
4 0
3 years ago
Write a calling statement for the following code segment in Java: public static int sum(int num1, int num2, String name) { int r
Pachacha [2.7K]

Answer:

Following are the calling of the given question

public static void main(String[] args) // main function

{

int store; // variable declaration

store = sum(32,15,"san"); // Calling of sum()

System.out.println(" TheValue returned by sum() : "+store); // display

}

Explanation:

Following are the description of the above statement

  • Here is the name of function is sum() In the sum() function definition there are 3 parameter in there signature i.e  two "int" type and 1 is "string" type .
  • In the main function we declared the variable store i,e is used for storing the result of sum() it means it storing the result of value that is returning from the definition of sum() function .
  • After that calling the function by there name and passing three parameter under it  sum(32,15,"san"); and store in the "store" variable.
  • Finally print the value by using system.out.println ().
3 0
3 years ago
When should students practice netiquette in an online course? Check all that apply.
mixas84 [53]

Answer:

when sending emails to classmates

when participating in online discussion boards

when collaborating as part of digital team

Explanation:

i just took the test

5 0
3 years ago
Other questions:
  • In older systems, often the user interface mainly consisted of ____-control screens that allowed a user to send commands to the
    11·1 answer
  • Which pane displays commands that change relative to the activity taking place in the presentation window's main work area?
    11·2 answers
  • Every time you are asked to work with others, you are being asked to:
    6·2 answers
  • A block level element begins on a new line and some space is usually added before and after it - True or False?
    13·1 answer
  • There is an enormous amount of information on the Internet that is automatically separated into good content and not-so-good con
    15·1 answer
  • What would be the result of running the command chown :root file1.txt
    14·1 answer
  • What stage in the process of media production involves discussing the budget and timelines as well as identifying stakeholders?
    15·1 answer
  • Which of the following are all involved in the evaluation of the presentation of a speech?
    5·1 answer
  • The script in the dynamic data section of the Web page template will check the value of the ____ array if the get method is used
    8·1 answer
  • 3 uses of Microsoft word in hospital
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!