Sunday, May 5, 2013

Program to find the Perfect Square of a Given number using C program


#include<stdio.h>
#include<math.h>
int main()
{
    int n,t;
    clrscr();
    printf("Enter n value :");
    scanf("%d",&n);
    t=sqrt(n);
    printf("%d \n",t);
    if(n==t*t)
    {
        printf("Given number is Perfect Square %d",t);
    }
    else
    printf("Given number is Not perfect");
getch();
}



output
Enter n value :49
7
Given number is Perfect Square 7

0 comments:

Post a Comment

Twitter Delicious Facebook Digg Stumbleupon Favorites More