Editorial for [Làm Quen OJ]. Bài 5. Hàm sqrt và cbrt
Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.
Submitting an official solution before solving the problem yourself is a bannable offence.
Submitting an official solution before solving the problem yourself is a bannable offence.
Author:
Có thể lưu giá trị của 2 hàm này vào số double rồi in ra hoặc in ra trực tiếp
#include <iostream>
#include <math.h>
#include <iomanip>
using namespace std;
//n++ vs ++n
int main(){
int n; cin >> n;
cout << fixed << setprecision(2) << sqrt(n) << endl;
cout << fixed << setprecision(3) << cbrt(n) << endl;
return 0;
}
Comments