Square root of the number by R4R Team

Example-
Square root of 4 is 2
Square root of 9 is 3
Square root of 16 is 4
Square root of 121 is 11

program-

#include< stdio.h>
#include
int main()
{
int n;
float ans;
printf("Enter number\n");
scanf("%d",&n);
ans=pow(n,0.5);
printf("Square root is %f",ans);
}


output-

Enter number
8
Square root is 2.828427

Enter number
16
Square root is 4.000000

-In this program, we take a input of the integer number and try to find the sqaure root of that number.
-We include the math library for the pow() function that are define in that library.
-pow(n,0.5) are able to return the required answer.




Leave a Comment:
Search
Categories
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!