Tuesday, June 4, 2019

Write a C Program to Find Square Root of Any Number

Find Square Root of Any Number in C

Program:

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

int main()
{
int num,ans;

printf("Enter any number: ");
scanf("%d",&num);
ans=pow(num,0.5);
printf("\n Square root of %d is: %d",num,ans);
getch();
}
...........................................................
Output:

Enter any number: 9

 Square root of 9 is: 3
--------------------------------
Process exited after 6.364 seconds with return value 0
Press any key to continue . . .

0 Comments:

Post a Comment