The excersize is: The quadrat in which a line drawn from the origin resides is d
ID: 3631593 • Letter: T
Question
The excersize is: The quadrat in which a line drawn from the origin resides is determined by the angle that the line makes with the positive X axis as follows:Angle from Positive X Quadrat
Between 0 and 90 I
Between 90 and 180 II
Between 180 and 270 III
Between 270 and 360 IV
using this information write a c programm that accepts the angle of the line as user input and determines and displays the quadrat appropriate to the input data (If angle is exactly 0, 90, 180,or 270, the line does not reside in a quadrat, ony on an axis)
I'm really illiterate in C and have no idea really what I'm doing. We were given a skeleton for it but I still am not sure how to go about doing this. When we int angle do we int 0,90,180,270,360;int angle; then angle=0; etc. ??
#include <stdio.h>
int main()
{
int angle;
/* Write the statements to prompt for the input of an angle.
Write the statement to input an angle */
if( ) // Enter logic to select 1st quadrant angle
{
printf(" The angle is in quadrant I");
}
else if( ) // Enter logic to select 2nd quadrant angle
{
printf(" The angle is in quadrant II");
}
else if( ) // Enter logic to select 3rd quadrant angle
{
printf(" The angle is in quadrant III");
}
else if ( ) // Enter logic to select 4th quadrant angle
{
printf(" The angle is in quadrant IV");
}
else if( ) // Enter logic to select 0,90,180,270 or 360
{
/* Modify the switch statment to select statment to work with the input angle */
switch()
{
/* In the case statements below enter the proper case constants to work with the the appropriate angle */
case :
printf(" The angle is on the positive X axis");
break;
case :
printf(" The angle is on the positive Y axis");
break;
case :
printf(" The angle is on the negative X axis");
break;
case :
printf(" The angle is on the negative Y axis");
break;
}
}
return 0;
}
Explanation / Answer
#include int main() { int angle; printf("Enter an angle between 0 to 360:"); scanf("%d",&angle); if(angle>0 && angle90 && angle180&& angle270 && angleRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.