Write a user-defined function that calculates the factorial

Assignment Help Electrical Engineering
Reference no: EM13268585

The factorial n! of a positive number (integer) is defined by n! = n.(n-1).(n-2)...3.2.1, where 0! = 1. Write a user-defined function that calculates the factorial n! of a number. For function name and arguments use y=fact(x), where the input argument x is the number whose factorial is to be calculated, and the output argument y is the value x!. The function displays an error message if a negative or non-integer number is entered when the function is called. Use fact with the following numbers: 12! 0! -7! 6.7!

Reference no: EM13268585

Questions Cloud

Calculate the value of inverter output voltage vo : A CMOS inverter has its nMOS transistor in non-saturation and its pMOS transistor in saturation. Kn = 50A/V2, Kp = 25 ?A/V2, Vtn = 0.5 V, Vtp = -0.6 V, (W/L)n = 2, (W/L)p = 4, IDD = 11 A, and VDD = 2 V. Calculate the inverter output voltage VO.
Explain resulting in a change of pressure : If a temperature of a gas at 1.00atm and 8.00C is increased, resulting in a change of pressure, which equation would you use to calculate the new pressure.
Calculate the present value of each dividend for years : Company is growing quickly. Dividends are expected to grow at 20 percent per year during the next three years, 10 percent over the following year, and then 6 percent per year thereafter. The required rate of return on this stock is 12 percent. The..
What force does the tractor exert on the trailer : A farm tractor tows a 4830 kg trailer up a 15.5° incline at a steady speed of 2.0 m/s. What force does the tractor exert on the trailer
Write a user-defined function that calculates the factorial : The factorial n! of a positive number (integer) is defined by n! = n.(n-1).(n-2)...3.2.1, where 0! = 1. Write a user-defined function that calculates the factorial n! of a number. For function name and arguments use y=fact(x)
Determine the radius of the smallest possible circle : A small 0.280-kg object moves on a frictionless horizontal table in a circular path of radius 4.30 m. The angular speed is 8.02 rad/s.what is the radius of the smallest possible circle on which the object can move
which suffers the least percentage price decline : Which bond suffers the greatest percentage price decline? Why? Which suffers the least percentage price decline? Why?
Explain how many more liters of water in a gallon : if a container can hold 2.0 gallons and 5.0 liters of water are added, how many more liters of water can be added to completely fill the 2.o gallon container? [ 1 gallon = 4 qts]
Plot the time path of the prices for each of the two bonds : Plot the time path of the prices for each of the two bonds (x-axis = years to maturity; y-axis = bond value)

Reviews

Write a Review

Electrical Engineering Questions & Answers

  How many total terms and literals are present in equations

Consider two Functions F = E(1,2,3,5,7,9) and G = E(0,5,7,8,9,11,13,15) a) Use K-maps to minimize the function Fb) Use K-maps to minimize the function G c) How many total terms and literals are present in the two equations

  What are the link length limits due to power and dispersion

For achieving a desired error probability, we are given that the receiver requires at least -30 dBm of power, and the maximum pulse spread must be no more than half of the bit period. The transmitted pulse has a spectral width of 0.5 nm, and the t..

  Give an expression for the ergodic capacity of the channel

Consider a SISO link with received signal α = hs + n, where h is a zero-mean complex Gaussian random varaible with unit variance, where the power of the data signal s is mathbbE (IsI2) = P, and where n is a zero-mean AWGN scalar with unit variance..

  What is the period of revolution of the alpha particles

A cyclotron used to accelerate alpha [articles (m=6.55 x 10^-27kg, q=3.2x10^19C) has a radius pf .50, and a magnetic field of 1.8T (a)what is the period of revolution of the alpha particles (b)what is their kinetic energy

  What is the cost of acquiring the land for an area

Your task as an engineer working for this real estate company is to first select a site for the housing venture. You are given that this area in Queens is prone to earthquakes due to seismic faults. The mean detection rate for tremors is 2 per sq...

  Calculate the pressure the plates exert on the air in plates

A capacitor is made with very large plates separated a distance d. The potential between the plates is V=1000 volts and d = 1mm. a) Calculate the pressure the plates exert on the air between the plates.

  How much electricity is used towards powering devices

In the United States, coal is a fossil fuel, used mainly to fuel the energy needed for electric power plants to manufacture electricity. The air pollution caused by burning coal has been linked to health problems and concerns for the general popul..

  Does the carrier frequency of a system have an impact

Does the carrier frequency of a system have an impact on small scale fading and shadowing. when moving over a distance x,will variations in received signal power be greater for low frequencies or high freq and why.

  Compute the magnitude of the dft for function using fftshift

a) Compute and plot the magnitude of the DFT for f(t) using "fftshift", assuming a sampling rate of 8000 Hz and a duration of 0.5 second. b) Window the samples of f(t) using a hann window

  What is the rms voltage of square wave

A square wave has a max value of 22 volts, a min value of -46 volts, and a frequency of 44 Hz. Note that it is not centered around the t-axis. what is its rms voltage?

  Design a low pass filter to suppress the carrier

At the receiver, demodulate the double side band signal S(t) = [cos(90*pi*t) + cos(120*pi*t)] * [cos(400*pi*t)], with the local carrier cos(400*pi*t). Design a low pass filter to suppress the carrier and plot the amplitude spectrum of S(t)

  Calculate the power factor from the input ac side

Considering that the only parameters known are the input line-to-line voltage of 415V rms (f=50Hz), the firing angle (a= degrees) and the overlap angle (b=15degrees), calculate the Power Factor as seen from the input AC

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd