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]
4 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]4 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
What do virtually all "phishing" emails have in common?
Arisa [49]
The name of your email/or dont have any name, asking for money, spelling mistakes, and sometimes a UNSUBSCRIBE button at the bottom of the email.
6 0
3 years ago
Consider the following class interfaces:
o-na [289]

Answer:

class teacher and student I didn't actually read it but I think it is class student

6 0
3 years ago
How to use a state value in stylesheet in react native.
lana66690 [7]

Answer:

Change this code:

return <View style={[styles.container, backgroundColor: this.state.bg]}/>

for this code:

return <View style={[styles.container, {backgroundColor: this.state.bg}]}/>

3 0
2 years ago
A named storage location in the computer's memory that holds a piece of information is a(n):
DaniilM [7]
Variable or scalar is a storage address (identified by a memory address) paired with an associated symbolic name, which contains some known or unknown quantity of information referred to as a value.
5 0
3 years ago
What is the mass of the light bulb? a. 425.6 g b. 204.6 g c. 240.56 g d. 245.6 g
Veronika [31]
The answer to your question is ----> <span>245.6 g

Hope this answer has helped you. If it has, please mark it a brainliest. Thanks.

Have a BRAINLY day.</span>
4 0
4 years ago
Read 2 more answers
Other questions:
  • Using refracted laser light to store data on a photoreceptive substrate is essentially how ___ storage works. Theoretically this
    5·1 answer
  • I plugged my phone up into a charger, the charger sparked and i unplugged my phone and now it wont charge at all, does anyone kn
    13·1 answer
  • Henry is studying the effects of deforestation along the slopes of hills and mountains. He wants to take a photo of a mountain s
    14·1 answer
  • A server that provides data transfer and storage space at remote locations is called a
    7·1 answer
  • Plzzz help! It’s due soon and I can’t figure it out
    13·1 answer
  • Which of the following is not a type of Internet Job Board? Options Resume Blaster Professional Association Target Applicants We
    8·1 answer
  • You have a large TCP/IP network and want to keep a host's real time clock synchronized. What protocol should you use?
    10·1 answer
  • Examples of application software​
    7·2 answers
  • You send a friend a private message about something personal that is going on with you. Without permission, she forwards your te
    10·1 answer
  • PYTHON 3 CODE HS HELP PLZ
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!