Write a program that inputs an angle and determines whether the angle is an acute angle, obtuse angle or a right angle (uses if-else-if).
Algorithm
- Step1: Start
- Step2: Declare angle as variable
- Step3: If angle is greater than 0 and less
- than 90 then display Acute Angle
- Step4: If angle is equal to 90 then the
- angle is Right angle
- Step5: If angle is greater than 90 and less
- than 180 then the angle is Obtuse angle
- Step6: End
Flowchart
Code
# include <iostream>
using namespace std;
int main ()
{
int angle;
cout<<"Put the value of Angle="<< endl;
cin>>
angle;
if (angle> 0 && angle<90)
{
cout<<"This is Acute
angle"<< endl;
}
else if (angle==90)
{
cout<<
"This is Right angle"<< endl;
}
else if
(angle>90&&angle<180)
{
cout<<"This is Obtuse angle"<< endl;
}
else
{
cout<<"You entered a invalid angle"<<
endl;
}
return 0;
}
No comments:
Post a Comment