cmath Functions

Lab C++ Beginner 10 points

Read a decimal x ≥ 0. Print sqrt(x), pow(x, 3), round(x) and floor(x), each with 2 decimals.

Input

One number.

Output

Four lines.

Example

Input

2

Output

1.41
8.00
2.00
2.00
Sample input available Sample output available
Editor
C++

Hints

#include <cmath>.

Solution explanation

Setting fixed and the precision once applies to every later number.

Show solution
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;

int main() {
    double x;
    cin >> x;
    cout << fixed << setprecision(2);
    cout << sqrt(x) << "\n" << pow(x, 3) << "\n" << round(x) << "\n" << floor(x) << "\n";
    return 0;
}
Output
Answer
HOME LEARN COMMUNITY DASHBOARD