Can someone covert the code into C language
#include<iostream>
#include<iomanip>
#include<ios>
using namespace std;
/********************************************************************************
Function name: main
Purpose:
main function
In parameters: b,r,i
Out paramters: trun,error,total,value
Version:
1.0
Author:
********************************************************************************/
void main()
{
int i;//declaring this variable to get value for
quitting or calaculating series
do {//do while loop to calaculate series until user
quits
cout << "Enter 1 to evaluate
the series." << endl;
cout << "Enter 2 to quit"
<< endl << endl;
cin >> i;
if (i == 2)
{
cout <<
"Exiting..." << endl;
exit(0);
}
else if (i < 1 || i> 2 )//if
the user enters any value except 1 or 2
{
cout <<
"Please enter a valid input." << endl;
}
else
{
double
b;//declared so user will enter proper number of terms
do {//do while
loop to ensure user enters proper number of terms
cout << "Please enter the number of
(non-zero) terms in the series (1,2,3,4,5,6)." << endl;
cin >> b;
cout << endl;
if (b < 1 || b>6)//if the user entered a
number that was not between 1-6
cout << "Incorrect
number of terms." << endl;
} while (b <
1 || b>6);
double
r;//declared to get range in between 0 and 0.9.
do {
cout << "Please enter the range of B to
evaluate in increments (0.0 < B >=0.9)." << endl;
cin >> r;
if (r < 0.1 || r>0.9)//if entered number
was smaller than 0 or greater than 0.9
cout << "Incorrect
range." << endl;
} while (r <
0.1 || r>0.9);
cout <<
endl;
cout <<
"MACLAURIN SERIES " << endl;
cout << "
B V(B) Series V(B) Exact Relative Error %RSerE" <<
endl;
cout << "0
1 1 0 0" << endl;
for (double x =
r / 10; x <= r; x = x + r / 10)//this loop while calculate
series in 10 increments
{
double value = 1 / sqrt(1 - (x *
x));//calculating exact value of series
double total = 1;//variable to hold total of
series,adding 1 because first value of series will always be
1
for (int j = 2; j <= b; j++)//calculating
each term in the series
{
if (j == 2)
{
total +=
(x * x) / 2;//factorials have already been calcuated and each term
has been simplified,here we are adding value of each term
}
else if (j == 3)
{
total +=
(x * x * x * x * 3) / 8;
}
else if (j == 4)
{
total +=
(x * x * x * x * x * x * 5) / 16;
}
else if (j == 5)
{
total +=
(x * x * x * x * x * x * x * x * 35) / 128;
}
else if (j == 6)
{
total +=
(x * x * x * x * x * x * x * x * x * x * 63) / 256;
}
}
double error = (value - total) /
value;//calcuating relative error
double trun = 0;//variable to hold truncative
error
if (b + 1 == 2)//these if statements will sue
the first truncative term to find truncative error
{
trun = (x * x) / 2;
trun = trun * 100 /
value;
}
else if (b + 1 == 3)
{
trun = (x * x * x * x * 3) /
8;
trun = trun * 100 /
value;
}
else if (b + 1 == 4)
{
trun = (x * x * x * x * x * x
* 5) / 16;
trun = trun * 100 /
value;
}
else if (b + 1 == 5)
{
trun = (x * x * x * x * x * x
* x * x * 35) / 128;
trun = trun * 100 /
value;
}
else if (b + 1 == 6)
{
trun = (x * x * x * x * x * x
* x * x * x * x * 63) / 256;
trun = trun * 100 /
value;
}
else
{
trun = (x * x * x * x * x * x
* x * x * x * x * x * x * 10395) / 46080;
trun = trun * 100 /
value;
}
printf("%g", x);//print each increment
std::cout << std::fixed;//so the values
wont be rounded
std::cout << std::setprecision(10);//so
the output of each double will be to 10 decimal place
cout << " " << total << " "
<< value << " ";
std::cout << std::defaultfloat;//to get
output in scientific as well as non scientific if required
cout << error << " ";
cout << trun << endl;
}
cout <<
endl;
}
} while (i != 2);//this loop will end when user
presses 1
}
In: Computer Science
The inventory on hand at the end of 2016 for Reddall Company is valued at a cost of $94,000. The following items were not included in this inventory:
Required:
Determine the cost of the ending inventory that Reddall should report on its December 31, 2016, balance sheet, assuming that its selling price is 140% of the cost of the inventory.
$_________
In: Accounting
*A PPE is acquired for 10.000 $ at the beginning of 2016. It had a useful life of 5 years. On January 1, 2018 the asset was revalued to 12.000 $. What would be the comprehensive income in year 2018?
a) 6.000
b) 4.000
c) 2.000
d) 3.000
*Suppose that a company has 2 buildings, one for investment (A) and one for administrative (B) purposes. Both properties have an initial cost of 1.000.000 $. The company does not use the cost model and both properties have 10 years of useful lives. A is revalued one year later and the revalued amount is 900.000 $. B is also revalued one year later and the revalued amount is 1.200.000 $. After the revaluation the company immediately sells A at 950.000 $ and sells B at 800.000 $. What is the profit/loss amount in the income statement for all of the transactions above?
a) 50.000 loss
b) 250.000 loss
c) 100.000 profit
d) 150.000 profit
*What does PIRATE stand for intangible assets?
a) Criteria for capitalizing research costs
b) Criteria for capitalizing development costs
c) Criteria for capitalizing directly attributable costs
d) Criteria for capitalizing amortization costs
In: Accounting
A paired difference experiment yielded pairs of observations. What is the rejection region for testing H_0:μ_d=2 vs H_a:μ_d>2 for the following case n_d=10,α=0.05.
(A) t >1.833 (B) t <-1.833 (C) t >1.328 (D) t >2.776
In: Statistics and Probability
Explain why we must verify whether or not the assumptions of an inferential statistical test are met before we calculate the statistic. Specifically, what does a failure to meet the assumptions mean in terms of the α level of our experiment? What should we do if the assumptions are not met?
In: Statistics and Probability
Explain why we must verify whether or not the assumptions of an inferential statistical test are met before we calculate the statistic. Specifically, what does a failure to meet the assumptions mean in terms of the α level of our experiment? What should we do if the assumptions are not met?
In: Statistics and Probability
In: Statistics and Probability
In a Compton scattering experiment, an x-ray photon scatters through an angle of 22.2° from a free electron that is initially at rest. The electron recoils with a speed of 2,520 km/s.
(a) Calculate the wavelength of the incident photon.
nm
(b) Calculate the angle through which the electron scatters.
°
In: Physics
I'm doing a experiment for organic chemistry. I'm extracting amino acids from lentils and quinoa. I know which amino acids are in them. I need help on what to write for the items below.
Introduction or Abstract –
Background – .
Results and Discussion –
Conclusion – .
Future work – ”
In: Chemistry
What is the solubility of AgCl om 0.01 M AgNO3? What and how large is the error this solubility would cause in the results of gravimetric experiment? you may assume the total volume of the solution to be 250 mL. Please comment on the significance of this amount of chloride lost due to solubility.
In: Chemistry