Question

Language : C Im more trying to understand this, an example would help which is why...

Language : C

Im more trying to understand this, an example would help which is why i'm posting this question

Write script that after coordinates are inputted, prints quadrant or line that the point is on.

Should have function that returns a character indicating the quadrant or the line.

Probable Return values:

X (X-axis)

Y (Y-axis)

1 (1st quadrant)

2 (2nd quadrant)

3 (3rd quadrant)

4 (4th quadrant)

The printing of the quadrant should be handled inside the main function.

Example:

Enter point coordinates: 7 8

The point lies on the first quadrant

Enter point coordinates: 7 0

The point lies on the X-line

0 0
Add a comment Improve this question Transcribed image text
Answer #1

#source code:

#include<stdio.h>

int main(){

int x,y;

printf("Enter point coordinates:");

scanf("%d %d",&x,&y);

if(x>0 && y> 0){

printf("The point lies on the first quadrant\n");

}

else if(x<0 && y>0){

printf("The point lies on the second quadrant\n");

}

else if(x<0 && y<0){

printf("The point lies on the third quadrant\n");

}

else if(x>0 && y<0){

printf("The point lies on the forth quadrant\n");

}

else if(y==0){

printf("he point lies on the X-line\n");

}

else if(x==0){

printf("he point lies on the Y-line\n");

}

return 0;

}

i #include<stdio.h> int main({ int x,y; printf(Enter point coordinates:); scanf(%d %d,&x,&y); if(x>0 && y> 0){ printf(Th

#output:

user@user-Latitude - 3490:-/Desktops gcc point.c -o sample user user -Latitude - 3490:-/Desktop$ ./sample Enter point coordin

#if you have any doubt or more information needed comment below..if you like give thumbs up...

Add a comment
Know the answer?
Add Answer to:
Language : C Im more trying to understand this, an example would help which is why...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Please help me with this MATLAB programming problem! Im coding iin MATLAB2018 if that makes any d...

    Please help me with this MATLAB programming problem! Im coding iin MATLAB2018 if that makes any difference! The first picture is the question i need to answer. The picture below is used as reference to answer the question. The last picture (below) is the into to the problem, and is used as reference. 1. Use Matlab to create the following single plot with three subplots. All titles, gridlines, and axis labels should be as shown. Arc System Response 15 E...

  • Q1 SUMMER2020- nts python language Example Write a program to read an integer r then print...

    Q1 SUMMER2020- nts python language Example Write a program to read an integer r then print a triangle with r number of rows using .asterisks Result Input 5 Hint: Use end= parameter of the print function to not add a newline to the end of the string * * * * * * * * * * * * 9 - عام python language Course Information o Course Material Assignments o example input Lab Exercises Quizzes Result 7.0 ACUTE 7.0...

  • (use only variables, expression, conditional statement and loop of c programming) ***C programming** int sum_of_cubes(int n)...

    (use only variables, expression, conditional statement and loop of c programming) ***C programming** int sum_of_cubes(int n) { } int quadrant(int x, int y) { } int num_occurrences_of_digit(long num, int digit) { return 0; } 3.1 int sum_of_cubes(int n) This function should return the sum of the cubes of the first n integers. For example, if n is 4, it should return 13 +23+ 39 +4°. There is a simple formula for the result: 3x = ((n + 1)) = +...

  • I need help programming this question using C language. This program uses input data entered in...

    I need help programming this question using C language. This program uses input data entered in command line at the same time when the command or .exe file is entered. They are called command-line arguments. Because everything entered in command line is taken as a string, these arguments including the command itself or the .exe file name are stored in an array of char pointers, each pointer points to the first character of a string (i.e., argument). The inputs can...

  • 019.09 points | Previous Answers SerCP9 1.AE.009 EXAMPLE 1.9Cartesian and Polar Coordinates GOAL Understand how to...

    019.09 points | Previous Answers SerCP9 1.AE.009 EXAMPLE 1.9Cartesian and Polar Coordinates GOAL Understand how to convert from plane rectangular coordinates to plane polar coordinates and vice versa. y (m) PROBLEM (a) The Cartesian coordinates of a point in the xy-plane are (x,y) (-3.50 m, -2.50 m), as shown in the NY figure. Find the polar coordinates of this point. (b) Convert (r, θ) = (5.00 m, 37.0°) to rectangular coordinates x (m) (-3.50,-2.50) STRATEGY Apply the trigonometric functions and...

  • i need #6 but i believe #6 function needs to call #5 function. I would like...

    i need #6 but i believe #6 function needs to call #5 function. I would like this in C language, and have no pointers, arrays or strings (on function calling and parameters). Thanks! I have attached the other functions that you might need to call for function 6 1. Write and test a function called is_multiple_of that takes a integer n1, integer n2 and determines whether the second argument (n2) is a multiple of the first argument (n1). The function...

  • Imagine we are using a two-dimensional array as the basis for creating the game battleship. In...

    Imagine we are using a two-dimensional array as the basis for creating the game battleship. In the game of battleship a '~' character entry in the array represents ocean, a '#' character represents a place ion the ocean where part of a ship is present, and an 'H' character represents a place in the ocean where part of a ship is present and has been hit by a torpedo. Thus, a ship with all 'H' characters means the ship has...

  • IT Review    JAVASCRIPT (Can someone please help me answer the below questions. It would be nice...

    IT Review    JAVASCRIPT (Can someone please help me answer the below questions. It would be nice if you add comments explaining what you are doing? If unable to add comments the answer would be fantastic. Thank you. Given the following function definition: function percent(x) {      return x / 100; } Which of the following statements correctly calls the percent function: percent(10); percent: 10; percent(); percent = 10; Indicate whether each of the following evaluates to true or false, given...

  • The last 3 cases are tests .cpp files to test the code. The language of this...

    The last 3 cases are tests .cpp files to test the code. The language of this code must be C++ because that is the only I am familiar with. Soreland, a software company, is planning on releasing its first C++ compiler with the hopes of putting MiniSoft's Visual C++ out of business (that reminds me of another story). Consequently, Soreland has contracted with the Fruugle Corporation to design and build part of their compiler. Of course, since Fruugle gets all...

  • please there are some specific instructions on the question so i would greatly appreciate if they...

    please there are some specific instructions on the question so i would greatly appreciate if they are followed . thank you very much for your time This lab covers: arrays functions input exception handling Question 1 The purpose of this question is to write a python program (script) that manipulates arrays using vector arithmetic. You will compute the values of points The ellipse has a major axis whose length is a and a minor axis whose length is b. For...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT