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
andriy [413]
3 years ago
11

Write a MATLAB code which asks a user for an integer number and computes the factorial of that number. Use while loop to create

the code.
Computers and Technology
1 answer:
ivann1987 [24]3 years ago
7 0

Answer:

my_int=input('Enter an integer to calculate its factorial: ');

i=1;%Counter to the while loop

r=1;%To keep the result

while i<=my_int

   r=r*i;

   i=i+1;

end

display('The result is:')

r

Explanation:

The factorial is the multiplication of all positive integers from 1 to n , my_int is the value of n in the program, in a while loop you need a condition that is met until all the positive integers have been multiplied, i is the counter that allows this (starts has one and is increasing by one till it gets the value of n)  and also is useful to make the multiplication and r keeps the result of each step until the condition stop being met and then the program the program leaves the loop and displays the solution.

You might be interested in
The fall of the Berlin Wall and the emergence of a way to find things on the Web through the Netscape browser were two that was
Romashka-Z-Leto [24]
<h2>Answer:</h2>

Option 4. a way for software to communicate and become interactive

is the correct answer.

<h2>Explanation:</h2>

<h2>The fall of the Berlin Wall and the emergence of a way to find things on the Web through the Netscape browser were two that was browser were two events that flattened the world. A third platform was needed to change the world and that was a way for software to communicate and become interactive.</h2><h2 />

This question belongs to the advent of software and technology that has made world a global village. The factors that played important roles are Fall of Berlin wall and Netscape browser.

The third thing the added to connectivity among people is the production of softwares like Skype and other social applications that made it easier for people to interact with other and communicate faster.

<h2>i hope it will help you!</h2>
5 0
3 years ago
What processes can move a solute against its concentration gradient?
Rudiy27

Explanation:

To move substances against a concentration or electrochemical gradient, the cell must utilize energy in the form of ATP during active transport. Primary active transport, which is directly dependent on ATP, moves ions across a membrane and creates a difference in charge across that membrane.

7 0
3 years ago
Sharon is a skilled professional who operates logging equipment.
Viktor [21]
Natural resource systems hope this helps

7 0
2 years ago
Read 2 more answers
Which of the following is a safe work practice to protect you from electrocution hazards?
Flura [38]
What are the answer choices?
7 0
3 years ago
Which of the following is FALSE? Select one: a. The fast-paced and collaboration-based business environment makes email less use
12345 [234]

Answer:

The Atos case demonstrates that it is possible to cut out e-mail entirely.

Explanation:

6 0
3 years ago
Other questions:
  • Which presenter would most likely benefit from a custom slide show?
    10·2 answers
  • What is the purpose of the chart feature in word?
    15·1 answer
  • Trish has bought a new computer that she plans to start working on after a week. Since Trish has not used computers in the past,
    10·1 answer
  • There are 12 inches in a foot and 3 feet in a yard. Create a class named InchConversion. Its main() method accepts a value in in
    10·1 answer
  • Diane is receiving a lot of unwanted e-mail. What steps can she take to reduce the amount of e-mail she receives?
    12·1 answer
  • A Tracking Gantt chart is based on the percentage of work completed for project tasks or the actual start and finish dates. True
    12·1 answer
  • Two-dimensional random walk (20 points). A two-dimensional random walk simulates the behavior of a particle moving in a grid of
    14·1 answer
  • Please Help meeeeeeeeeee:
    11·2 answers
  • To create a program in Scratch, you need to think systematically about the order of steps. This is known as
    11·1 answer
  • A program that converts a program to binary all at once and runs the entire program when finished with the conversion.
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!