C program to find square root of a number

Previous
Next

Input

            Enter any number: 9

Output

            Square root of 9 = 3

#include <stdio.h>
#include <math.h>
int main()
{
	double num, root;
	
	printf("Enter number to find it's square root : ");
	scanf("%lf", &num);
	
	root = sqrt(num);
	printf("Square root of %.2lf = %.2lf", num, root);
	return 0;
}
Previous
Next

Add Comment

Courses Enquiry Form