bsc

Comprehensive codebase and cou...
Log | Files | Refs | README | LICENSE

luc017.c (870B)


      1 /*
      2  * Author: Amit Dutta (amitdutta4255@gmail.com) | Date: 12 Dec 2025
      3  * Repo: https://github.com/notamitgamer/bsc
      4  * License: MIT
      5  */
      6 
      7 /* Given a point (x, y), write a program to find out if it lies on X-axis, Y-axis or origin. */
      8 /* Let Us C, Chap- 3, Page - 53, Qn No.: f(h) */
      9 
     10 #include <stdio.h>
     11 #include <math.h>
     12 #define EPSILON 0.00001
     13 
     14 int main()
     15 {
     16     double x, y;
     17     printf("Enter the point P(x, y) : ");
     18     scanf("%lf %lf", &x, &y);
     19     if (fabs(x) < EPSILON && fabs(y) < EPSILON)
     20         printf("\nPoint P(%g, %g) lies on the origin.", x, y);
     21     else if (fabs(x) < EPSILON)
     22         printf("\nPoint P(%g, %g) lies on the Y-Axis.", x, y);
     23     else if (fabs(y) < EPSILON)
     24         printf("\nPoint P(%G, %g) lies on the X-Axis.", x, y);
     25     else
     26         printf("\nThe point P(%g, %g) lies in a QUADRANT (not on an axis or the origin).", x, y);
     27     return 0;
     28 }
© notamitgamer • Site Built: 2026-07-21 13:58:23 UTC • git-mirror commit: 1037f62 [view raw info]
Originally created with stagit • modified by notamitgamer
Forked from github.com/notamitgamer/git-mirror