2
Thanks

A few words of thanks would be greatly appreciated.

How To Find Square Root in C Program

One of various computer programming languages, C is the most basic and widely used language, likely because it gives maximum efficiency and control to programmers. The C language can be used for mathematical operations, ranging from additions and subtractions to square roots and cube roots, along with other polynomial powers that can be created through C programming.


To find the square root of a number, you can customize the C script to code the logic by using the sqrt function. This tutorial will show you how.

Finding a Square Root in C Program

Here is sample program:


#include <math.h>    
#include <stdio.h>

int main(void)
{
double x = 4.0, result;

result = sqrt(x);
printf("The square root of %lf is %lfn", x, result);
return 0;
}

Image: © Arian Darvishi - Unsplash.com
2
Thanks

A few words of thanks would be greatly appreciated.

Ask a question
Jean-François Pillou

CCM is a leading international tech website. Our content is written in collaboration with IT experts, under the direction of Jeff Pillou, founder of CCM.net. CCM reaches more than 50 million unique visitors per month and is available in 11 languages.

Learn more about the CCM team

Related

Published by . Latest update on by Olivia Long.

This document, titled "How To Find Square Root in C Program," is available under the Creative Commons license. Any copy, reuse, or modification of the content should be sufficiently credited to CCM (https://ccm.net/).

0 Comments