I have used the

**if....else**statement in which I have provided the required conditions to get the perfect output.

I have stated that if the value of the denominator in any of the fraction is equal to

**0**then display that it is

**NOT DEFINED**. But still it gives me an error i.e.

**Floating Point: Divide by Zero**. I don't want this error in my output. I know that length cannot be zero in a triangle but still for my sake I want to get the required output.

Please do help me to sort out this issue. I am a beginner and don't know much about all the available operators and header files! So, I always create functions to carry out any operations needed.

#include<iostream.h> #include<conio.h> void main() { double x, y, r, angle; double sinn, cosn, tann, cotn, secn, cosecn; cout<<"Enter the measure of angle in degrees: "; cin>>angle; cout<<"Enter the length of the side opposite to the angle: "; cin>>y; cout<<"Enter the length of the side adjacent to the angle: "; cin>>x; cout<<"Enter the length of the hypotenuse: "; cin>>r; clrscr(); sinn=y/r; cosn=x/r; tann=y/x; cotn=x/y; secn=r/x; cosecn=r/y; while(0>=(x, y, r)>=0) { if(r==0) { cout<<"sin("<<angle<<")= NOT DEFINED"<<endl<<endl; } else { cout<<"sin("<<angle<<")= "<<sinn<<endl<<endl; } if(r==0) { cout<<"cos("<<angle<<")= NOT DEFINED"<<endl<<endl; } else { cout<<"cos("<<angle<<")= "<<cosn<<endl<<endl; } if(x==0) { cout<<"tan("<<angle<<")= NOT DEFINED"<<endl<<endl; } else { cout<<"tan("<<angle<<")= "<<tann<<endl<<endl; } if(y==0) { cout<<"cot("<<angle<<")= NOT DEFINED"<<endl<<endl; } else { cout<<"cot("<<angle<<")= "<<cotn<<endl<<endl; } if(x==0) { cout<<"sec("<<angle<<")= NOT DEFINED"<<endl<<endl; } else { cout<<"sec("<<angle<<")= "<<secn<<endl<<endl; } if(y==0) { cout<<"cosec("<<angle<<")= NOT DEFINED"<<endl<<endl; } else { cout<<"cosec("<<angle<<")= "<<cosecn<<endl<<endl; } cout<<"Enter the measure of angle in degrees: "; cin>>angle; cout<<"Enter the length of the side opposite to the angle: "; cin>>y; cout<<"Enter the length of the side adjacent to the angle: "; cin>>x; cout<<"Enter the length of the hypotenuse: "; cin>>r; clrscr(); sinn=y/r; cosn=x/r; tann=y/x; cotn=x/y; secn=r/x; cosecn=r/y; } getch(); }