Header Ad

C++ program to calculate the square root of given number

In this post, we will write a C++ program to calculate the square root of a given number.

C++ program to calculate the square root of given number


C++ program to calculate the square root of given number.

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

int main()
{
    system("cls");

    int n;
    float res;

    std::cout<<"Enter any number = ";
    std::cin>>n;

    res = sqrt(n);

    std::cout<<"The square root of number is = "<<res<<std::endl;

    getch();
    return 0;
}



Output

Enter any number = 64
The square root of number is = 8

Post a Comment

0 Comments