Question
Kindly write it in c++ language. from dev c++ . Write a program to find out...
kindly write it in c++ language. from dev c++ .
Write a program to find out the factorial of an integer using loop Formula to find the factorial of an integer is: n*(n-1)*(n-2)*......... 1.
Answers
PROGRAM :
type 1:
#include <iostream>
using namespace std;
unsigned int factorial(unsigned int n)
{
if (n == 0)
return 1;
return n * factorial(n - 1);
}
int main()
{
int num = (15);
cout << "Factorial of "
<< num << " is " << factorial(num) << endl;
return 0;
}type2 :
#include <iostream>
using namespace std;
int main()
{
unsigned int n;
unsigned long long factorial = 1;cout << "Enter a positive integer: ";
cin >> n;for(int i = 1; i <=n; ++i)
{
factorial *= i;
}cout << "Factorial of " << n << " = " << factorial;
return 0;
}
Similar Solved Questions
1 answers
Neimann Vision Centers recently paid a $2.75 dividend and is a rapidly growing company. Dividends are...
Neimann Vision Centers recently paid a $2.75 dividend and is a rapidly growing company. Dividends are expected to grow at 35% for the next two years, then at 25% for the following two years. After that, dividends are expected to grow at 4% indefinitely. The required return on this stock is 10.5%. Wh...
1 answers
Question 1 The theoretical resolution of a TEM is given as 0.02 nm. The TEM is...
Question 1 The theoretical resolution of a TEM is given as 0.02 nm. The TEM is operating at 138 kv. Calculate the half aperture angle (degree)....
1 answers
Bonus: Maximum Power transfer i R RI. a. Show that R -Ri for maximum power transfer...
Bonus: Maximum Power transfer i R RI. a. Show that R -Ri for maximum power transfer in the circuit above (Use Calculus) b. What is the relationship between Zh and Zu in the circuit below? ac circuit...
1 answers
NASA sent a satellite to a circular orbit around Mars. The period of the orbit is...
NASA sent a satellite to a circular orbit around Mars. The period of the orbit is 128 minutes. Mass of Mars = 6.42 x 1023 kg Radius of Mars = 3.39 x 106 m What is the acceleration due to Mar's gravity at this orbital location? in m/s^2...
1 answers
In this MULTISIM exercise, you will simulate a common-source (CS) amplifier using an N channel MOSFET...
In this MULTISIM exercise, you will simulate a common-source (CS) amplifier using an N channel MOSFET You will need to turn in the following in the lab 1. 2. 3. This document with all the questions answered; Circuit diagram (in multisim); Plots of Vsig, Vc and Vo obtained from the oscilloscope. You ...
1 answers
Required information [The following information applies to the questions displayed below.) On January 1, 2021, Splash...
Required information [The following information applies to the questions displayed below.) On January 1, 2021, Splash City issues $320,000 of 8% bonds, due in 15 years, with interest payable semiannually on June 30 and December 31 each year. The market interest rate on the issue date is 9% and the b...
1 answers
A person walk south 340 meters and the East 160 meters and finally North 20 meters....
A person walk south 340 meters and the East 160 meters and finally North 20 meters. To the nearest, by how many meters was the distance walked greater than the magnitude of their displacement...
1 answers
Question 2 1 pts When a good is characterized by non-excludability, it is theoretically possible for...
Question 2 1 pts When a good is characterized by non-excludability, it is theoretically possible for the government to O reach the efficient outcome in spite of private market failure to do so. o increase the well-being of residents by raising taxes to provide the good. O All of the above. O elimina...
3 answers
How do you use cross products to solve #3.6/3=y/14.4#?
How do you use cross products to solve #3.6/3=y/14.4#?...
1 answers
Required information [The following information applies to the questions displayed below.) Cooper Corporation produces decorator wall...
Required information [The following information applies to the questions displayed below.) Cooper Corporation produces decorator wall coverings. Budgeted production is 240,000 square feet per month, and the standard direct labor requirement to make this amount is 6,000 hours. All overhead is allocat...
1 answers
A standard oriice with diameter 25 mm is installed in a horizontal pipe having an inside diameter...
Fluid dynamics: please help!! A standard oriice with diameter 25 mm is installed in a horizontal pipe having an inside diameter of 50 mm The pipe is to handle the steady flow of water at 20 °C. The average velocity of months of operation. It is desired to measure the pressure drop across the ori...
1 answers
The electric potential in a region of space is V= (350Vm) / ( sqrt(x^2 + y^2...
The electric potential in a region of space is V= (350Vm) / ( sqrt(x^2 + y^2 ), where x and y are in meters. A: What is the strength of the electric field at (x,y)=(2.6m,2.4m)? E= ? V/m B: What is the direction of the electric field at (x,y)=(2.6m,2.4m)? Give the direction as an angle ccw from the p...
1 answers
Marginal Revenue Product (MRP) curve is: Multiple Choice the market demand curve for labour and, is...
Marginal Revenue Product (MRP) curve is: Multiple Choice the market demand curve for labour and, is the sum of supply of labour to individual firms. the market demand curve for labour and, is the horizontal summation of the marginal factor cost to the individual firms. the market demand curve ...
1 answers
T duestions QUESTION 1: (20 marks) (a) A Mechatronic system uses a mechanical fioat valve system to sense and maint...
T duestions QUESTION 1: (20 marks) (a) A Mechatronic system uses a mechanical fioat valve system to sense and maintain the water level in a tank. The mechanical float vaive system is to be replaced to allow remote level indication ) State one type of sensor that could be used in the above (2 marks) ...
1 answers
'Who are the decision makers and how do they make decisions?
'Who are the decision makers and how do they make decisions?...