Search
 
SCRIPT & CODE EXAMPLE
 

CPP

sqrt cpp

#include <math.h>

//get square root of a number "b"
int main(){
  	int a = 2; //declare number you want to take square root of
  	int sqrtNum = sqrt (a); //assign the sqrt value to a variable
  	cout << sqrtNum << endl;
	return 0;
}
Comment

sqrt in c++

#include <iostream>
#include <cmath>
using namespace std;

int main()
{
	int x = 625;
	int result = sqrt(x);
	cout << "Square root of " << x << " is " << result << endl;
	return 0;
}
Comment

sqrt function in c++

#include <iostream>
#include<math.h>
using namespace std;
int main(){
    int num, result;
    cout<<"Enter a number: ";
    cin>>num;
    
    result = sqrt(num);
    
    cout<<"Square root = "<<result;
    return 0;
}
Comment

PREVIOUS NEXT
Code Example
Cpp :: how to writt array in c++ 
Cpp :: taking input from user in array in c++ 
Cpp :: vector of structs c++ 
Cpp :: note++ 
Cpp :: copy substring to another string c++ 
Cpp :: print vector 
Cpp :: cpp random number in range 
Cpp :: how to declrae an array of size 1 
Cpp :: find character in string c++ 
Cpp :: how to clear screen in C++ console 
Cpp :: rank() in c++ 
Cpp :: how to check sqrt of number is integer c++ 
Cpp :: clang cpp compile command 
Cpp :: what is __asm in C++ 
Cpp :: c++ user input 
Cpp :: sort function from bigest to smallest c++ 
Cpp :: c++ ros publisher 
Cpp :: c++ infinite for loop 
Cpp :: round double to n decimal places c++ 
Cpp :: c++ read image opencv in folder 
Cpp :: lerp function c++ 
Cpp :: c++ count number of element in vector 
Cpp :: matplotlib hide numbers on axis 
Cpp :: resize 2d vector c++ 
Cpp :: change integer to string c++ 
Cpp :: c++ enum 
Cpp :: why we use iostream in C++ programming 
Cpp :: 1d array 
Cpp :: calloc c++ 
Cpp :: Count Prefix of a Given String solution leetcode 
ADD CONTENT
Topic
Content
Source link
Name
3+8 =