Answer:
#include<iostream>
#include<iomanip>
using namespace std;
int main()
{
double PI_D = 3.14159256359;
float PI_F = 3.14159256359;
cout<<"i"<<"\t\t"<<"Float"<<"\t\t"<<"Double"<<endl;
for(int i = 1; i<=10;i++)
{
cout<<i<<"-\t\t"<<PI_F<<setprecision(i)<<"-\t\t"<<PI_D<<setprecision(i)<<endl;
}
return 0;
}
Explanation:
See Attachment where I used comments for explanation
Answer:
The function in Python is as follows:
def d2x(d, x):
if d > 1 and x>1 and x<=9:
output = ""
while (d > 0):
output+= str(d % x)
d = int(d / x)
output = output[::-1]
return output
else:
return "Number/Base is out of range"
Explanation:
This defines the function
def d2x(d, x):
This checks if base and range are within range i.e. d must be positive and x between 2 and 9 (inclusive)
if d >= 1 and x>1 and x<=9:
This initializes the output string
output = ""
This loop is repeated until d is 0
while (d > 0):
This gets the remainder of d/x and saves the result in output
output+= str(d % x)
This gets the quotient of d/x
d = int(d / x) ----- The loop ends here
This reverses the output string
output = output[::-1]
This returns the output string
return output
The else statement if d or x is out of range
<em> else:</em>
<em> return "Number/Base is out of range"</em>
<em />
Answer:
C
Explanation: This is because not every area is structured on the same ground as other places.
Answer:
30cm
Explanation:
Height X Base
6cm X 10cm
60cm
Then take half because a triangle is half a square and we are using a square formula.
60cm divided by 2
=30cm
B. The number of sharks decreases. Explanation: hope it's help i learned about it and you too