Guest User

Untitled

a guest
Dec 18th, 2017
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. //given a point (x,y) WAP to find if it lies in x-axis, y-axis or center
  2.  
  3. //include the standard lib
  4. #include<stdio.h>
  5.  
  6. //main is a collective name for set of instructions
  7. main()
  8. {
  9. //declare types for point info
  10. int x1,y1;
  11.  
  12. printf("Check which axis the point lies in\n");
  13. printf("\n---------------------------------\n");
  14.  
  15. printf("Provide circle info\n");
  16. printf("x1: \t");
  17. scanf("%d",&x1);
  18. printf("y1: \t");
  19. scanf("%d",&y1);
  20.  
  21. //compute the condition with if
  22. if(x1==0&&y1==0)
  23. printf("the point (%d,%d) lies on origin\n",x1,y1);
  24. else if(x1==0)
  25. printf("The point (%d,%d) lies on x-axis\n",x1,y1);
  26. else if(y1==0)
  27. printf("the point (%d,%d) lies on y-axis\n",x1,y1);
  28.  
  29. }
Add Comment
Please, Sign In to add comment