# Answer to Question #36497 in C++ for Gs

Question #36497

Can anyone tell me the error and its correction

#include<iostream.h>

#include<conio.h>

int sqr(int num , int div);

int main()

{

int num;

cout<<"enter ";

cin>>num;

int div = num;

int sqrt;

sqrt=sqr(num,div) ;

cout<<sqrt<<endl;

return 0;

}

if(div==1)

{

return 1;

}

else

{

if((num/(div*div))%1!=0)

{

div=sqr(num,div-1);

}

if((num/(div*div))%1==0)

{

return div;

}

}

#include<iostream.h>

#include<conio.h>

int sqr(int num , int div);

int main()

{

int num;

cout<<"enter ";

cin>>num;

int div = num;

int sqrt;

sqrt=sqr(num,div) ;

cout<<sqrt<<endl;

return 0;

}

if(div==1)

{

return 1;

}

else

{

if((num/(div*div))%1!=0)

{

div=sqr(num,div-1);

}

if((num/(div*div))%1==0)

{

return div;

}

}

Expert's answer

## Comments

## Leave a comment