Write a C program to enter any number and calculate its square root - Basic C program




Write a C program to enter any number and calculate its square root

Objective:

Write a C program to input a number and find square root of the given number. How to find square root of a number in C programming using inbuilt sqrt() function. How to use predefined sqrt() function to find square root in C program.


Example


Input
Enter any number: 9
Output

Square root of 9 = 3



Solution:

//C program to find square root of a number by CodexRitik #include <stdio.h> #include <math.h> int main() { double num, root; //Input a number from user printf("Enter any number to find square root: "); scanf("%lf", &num); //Calculate square root of num root = sqrt(num); //Print the resultant value printf("Square root of %.2lf = %.2lf", num, root); return 0; }


Note:

This Code is Verified by CodexRitik.If any error occurs then Comment correct code Below in comment box.

Disclaimer:-

The above hole problem solution is generated by the CodexRitik . if any of the query regarding this post or website fill the following contact form Thank You.

Write a C program to enter any number and calculate its square root - Basic C program Write a C program to enter any number and calculate its square root - Basic C program Reviewed by CodexRitik on January 11, 2021 Rating: 5

1 comment:

Powered by Blogger.