FastFoodCoding

Login


Connect with one of the following accounts





Login

Please wait while we redirect...

Views: 36   



Following program shows you how to take a number as input and calculate the square root of given number.
In this program we get input from user and calculate square root using sqrt(input) method

#include <iostream>
#include <math.h>

int main() {
    int input;
    std::cout << "Enter a number:";
    std::cin >> input;
    float result = sqrt(input);
    std::cout << "Input: " << input << "\n";
    std::cout << "Square Root of " << input << " is: " << result;
}

Output:

Enter a number: 4
Input: 4
Square Root of 4 is: 2



On By


Top Tutorials

Top Questions

Top Articles

Top Blogs

Top News