Tuesday, 9 December 2014

C Program to find square root of a number

Program to find square root of a number
#include<stdio.h>
#include<stdlib.h>
main()
{
int n,i;
printf("enter n\n");
scanf("%d",&n);
for(i=1;i<=n;i++)
if(i*i==n)
printf("square root of %d is %d\n",n,i);
}
OutPut:
enter n
4
square root of 4 is 2