Base units need not have ANY volume. A second is the base unit for measuring time and it has no volume!
Volume = Base Area * Height So Height = Volume/Base Area
Volume of a rectangular prism is equal to the base area x height. (V=BxH or Volume = Base Area * Height) To get the base area, simply divide the volume by the height. (B=V/H or Base Area = Volume / Height)
Divide the base area into its volume
Base = sqrt(Volume/Height)
The number of digits is immaterial, the principal is exactly the same. The key to reversing any number is in the following user-defined function: uint reverse(uint num) { uint rev=0; while(num) { rev*=10; rev+=num%10; num/=10; } return(rev); } The following code demonstrates how to reverse a 6 digit number entered from the console. #include<iostream> #include<string> #include<sstream> typedef unsigned int uint; uint reverse(uint num) { uint rev=0; while(num) { rev*=10; rev+=num%10; num/=10; } return(rev); } int getrange(uint digits,uint& min,uint&max) { if(!digits) return(-1); min=1; while(--digits) min*=10; max=min*10-1; return(0); } uint inputnumber(const std::string prompt,const uint min,const uint max) { using namespace std; uint result=0; while(1) { cout<<prompt; string s; getline(cin,s); if(s.size()) result=stoul(s,0,10); if(result<min result>max) cout<<"The number must be in the range " <<min<<".."<<max<<"\n" <<"Please enter another number.\n"<<endl; else break; } return(result); } uint inputnumber(const uint digitcount) { using namespace std; uint min=0, max=0; if(getrange(digitcount,min,max)==-1) return(0); std::stringstream prompt; prompt<<"Enter a "<<digitcount<<" digit number: "; return(inputnumber(prompt.str(),min,max)); } int main() { using namespace std; uint num=inputnumber(6); // 6 digits. if(num) { uint rev=reverse(num); cout<<"Reverse: "<<rev<<"\n"<<endl; } return(0); } Output: Enter a 6 digit number: 123456 Reverse: 654321
That can't be answered. The volume of the base of what kind of base?
You mean an iterative function, not a recursive one. A recursive function is one that calls itself with altered arguments, typically used to implement divide-and-conquer algorithms. Since the arguments remain the same and you're not dividing the array into smaller subsets, recursion is not necessary. An iterative loop is all you need: typedef unsigned int UINT; const UINT CountOddNumbers( const UINT* const A, const UINT size) { UINT result=0; for(UINT i=0; i<size; ++i) result += A[i]&1; return(result); } Note that this function is not safe, since size is not guaranteed to reflect the actual size of A. In C++, it's better to use a vector object, since vectors encapsulate the actual size of the embedded array: const UINT CountOddNumbers( const std::vector<UINT> A) { UINT result=0; for(UINT i=0; i<A.size(); ++i) result += A[i]&1; return(result); }
Base units need not have ANY volume. A second is the base unit for measuring time and it has no volume!
Volume = Base Area * Height So Height = Volume/Base Area
Volume of a rectangular prism is equal to the base area x height. (V=BxH or Volume = Base Area * Height) To get the base area, simply divide the volume by the height. (B=V/H or Base Area = Volume / Height)
volume=base multiplied by heigth
Well,i guess the same volume as the base.
Divide the base area into its volume
Volume of a rectangular prism = base x height. If volume and height are known, solve for base area by dividing volume by height.
Volume = base area x height so Base area = Volume / height. For example, if the volume is 10cm3 and the height is 2cm, 10/2=5, the base area must be 5cm2.
Since: Volume = height x base Height = Volume / Base