Explanation:
#include <iostream.h>
#include <conio.h>
#include <math.h>
main ()
{
int x;
double sum, fact;
char ans;
do
{
cout << "Please enter the value x: ";
cin >> x;
cout << endl;
sum = fact = 1;
for (int n=1; n<=100; n++)
{
for (int i=0; i<n; i++)
{
fact = n*fact;
}
sum += (pow(x,n)/fact);
cout <<"n = "<<n<<" and sum = "<< sum << " and
exp("<<x<<") = "<<exp(x)<<endl;
}
cout << endl;
cout << "Do you want to calculate this again? (y/n): ";
cin >> ans;
} while (ans == 'y' || ans == 'Y');
getch ();
}
Answer:
Following are the program in python language the name of the program is factors.py
num= int(input("Please enter a positive integer: "))#Read the number by user
print("The factors of ",num,"are:")
for k in range(2,num): #iterating over the loop
if(num%k==0): #checking the condition
print(k)#display the factor
Output:
Please enter a positive integer: 12
The factors of 12 are:
2
3
4
6
Explanation:
Following are the description of the program
- Read the number by user in the "num" variable
- Iterating the for loop from k=2 to less then "num".
- In the for loop checking the factor of "num" variable by using % operator.
- Finally display the factor by using print function
Answer:
7) Electrical Energy used = 5000 J
8) Check below for answer and explanation
Explanation:
7) Let the Sound Energy Produced = SE
Electrical Energy = EE
Sound energy produced, SE = 1000 J
% of Electrical energy converted to sound = 20%
SE = 20% of EE
SE = (20/100) * EE
1000 = 0.2 EE
EE = 1000/0.2
EE = 5000 J
Electrical Energy used = 5000J
8) The vehicle's efficiency = 18%
Energy loss = 82%
The 82% energy loss in the vehicle can be due to the following reasons:
a) Heat generated by the exhaust of the vehicle
b) Noise generated by the vehicle
c) Frictional force in the engine
d) Combustion
A and B are the correct answers.