Ddddddddddddddddddddddddddddddddddddddddd
B (They can be resized without losing image clarity)
Answer:
// here is code in C++.
#include <bits/stdc++.h>
using namespace std;
// main function
int main()
{
// variables
int minn=INT_MAX;
int maxx=INT_MIN;
int n1,n2,n3,n4,n5;
cout<<"enter five Numbers:";
//read 5 Numbers
cin>>n1>>n2>>n3>>n4>>n5;
// find maximum
if(n1>maxx)
maxx=n1;
if(n2>maxx)
maxx=n2;
if(n3>maxx)
maxx=n3;
if(n4>maxx)
maxx=n4;
if(n5>maxx)
maxx=n5;
// find minimum
if(n1<minn)
minn=n1;
if(n2<minn)
minn=n2;
if(n3<minn)
minn=n3;
if(n4<minn)
minn=n4;
if(n5<minn)
minn=n5;
// print maximum and minimum
cout<<"maximum of five numbers is: "<<maxx<<endl;
cout<<"minimum of five numbers is: "<<minn<<endl;
return 0;
}
Explanation:
Declare two variables "minn" & "maxx" and initialize them with INT_MAX and INT_MIN respectively.Then read the five number from user and compare it with "minn" & "maxx" ,if input is greater than "maxx" then update "maxx" or if input is less than "minn" then update the "minn". After all the inputs, "minn" will have smallest and "maxx" will have largest value.
enter five Numbers:5 78 43 55 12
maximum of five numbers is: 78
minimum of five numbers is: 5
Answer:
1. #include <iostream>
2. #include <cmath>
3.
4. using namespace std;
5.
6. int main()
7. {
8. float radius;
9. cout << "Type the radius of the base: "; // Type a number
10. cin >> radius ; // Get user input from the keyboard
11.
12. float height;
13. cout << "Type the height: "; // Type a number and press enter
14. cin >> height; // Get user input from the keyboard
15.
16. float volumeCylinder = 3.1416 * radius * radius * height;
17. float cubeSide = std::pow(volumeCylinder, 1/3.);
18. cout<<"Cube side is: "<< cubeSide;
19.
20. return cubeSide;
21. }
Explanation:
- From line 1 to 5 we include two libraries
- From line 6 to 7 we declare our main function
- From line 8 to 11 we ask the user for the radius of the cylinder
- From line 12 to 15 we ask the user for the height of the cylinder
- On line 16 we calculate the volume of the cylinder using the formula V=pi*(r^2)*h
- On line 17 we calculate the side of the cube with the same volume as the cylindrical container using the formula side=∛(V)
- From line 18 to 21 we print and return the value of the cube's side