그냥 게임개발자

sqrt 본문

C++ 나만의 복습

sqrt

sudoju 2024. 4. 21. 19:43

제곱근을 구해주는 함수다.

 

#include <iostream>
#include <cmath>

using namespace std;

int main()
{
    int n = 64;
    int ret = (int)sqrt(n);
    
    cout << ret << '\n';
    
    return 0;
}

 

결과값은 8이 나옵니다.

64의 제곱근은 8이기 때문이죠

끄으읕

'C++ 나만의 복습' 카테고리의 다른 글

pow  (1) 2024.04.21
min_element()  (0) 2024.04.12
max_element()  (0) 2024.04.12
accumulate() - 배열의 합 구하기  (0) 2024.04.12
lower_bound() & upper_bound()  (0) 2024.04.12