Views: 143
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 <math.h>
#include <stdio.h>
int main() {
float input;
printf("Please enter a number:");
scanf("%f", &input);
float result = sqrt(input);
printf("Input: %f \n", input);
printf("Squre root of %f is %f", input, result);
}
Output:
Please enter a number: 9
Input: 9.000000
Squre root of 9.000000 is 3.000000
On By
Navya
Top Tutorials
492.5K
32K
21.8K
18.7K
18.7K
6.7K
6.7K
4.9K
3.3K
3.2K
Top Questions
18.7K
14.5K
8.3K
6.6K
6.2K
5.7K
4.8K
4.8K
4.3K
3.9K
Top Articles
1.9K
1.6K
947
Top Blogs
796
779
55
Top News
754
686
670
398
385
385