Sunday, April 30, 2023

find a point is lie on x axis,y axis or origin or not using c programming .

 //find a point is lie on x axis,y axis or origin or not 

#include "stdio.h"

int main ()

{

int x,y;

printf ("Enter the point : \n");

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

if (y==0 && x!=0){

printf ("The point is on x axis \n");

}

else if(x==0 && y!=0){

printf ("The point is on y axis \n");

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

printf ("The point is in the origin \n");

}

else{

printf ("the point is not on x or y or origin \n");

}

return 0;

}

       output    output    output    output    otuput

Enter the point :

5

0

The point is on x axis

                                         or

Enter the point :

0

6

The point is on y axis

                                        or 

Enter the point :

0

0

The point is in the origin

                                         or 

 Enter the point :

3

4

the point is not on x or y or origin


No comments:

Post a Comment

print a multiplication table of any integer taking from user

 // print a multiplication table of any integer taking from user  #include "stdio.h" int main () { int n,mul,i; printf ("...