C Language - Finding x - y Coordinates Location - And other Programs Set
#include <stdio.h>
#include <conio.h>
int main()
{
// int n;
// printf("Enter any number\n");
// scanf("%d", &n);
// if (n%2==0){
// printf("%d is a even number\n", n);
// }
// else{
// printf("%d is a odd number\n", n);
// }
//END...
int x,y;
printf("Enter x-coordinate\n");
scanf("%d", &x);
printf("Enter y-coordinate\n");
scanf("%d", &y);
if (x==0 && y==0){
printf("The Points are at the origin");
}
else if (x==0 && y!=0){
printf ("The point is on y-axis");
}
else if (x!=0 && y==0){
printf ("The point is on x-axis");
}
else if (x>0 && y>0){
printf ("The points lie in 1st quadrant");
}
else if (x<0 && y>0){
printf("The points lie in 2nd quadrant");
}
else if (x<0 && y<0){
printf ("The points lie in 3rd quadrant");
}
else if (x>0 && y<0){
printf ("The points lie in 4th quadrant");
}
// else if(x>'A' || x>'a' || x<'Z' || x<'z' || y>'A' || y>'a' || y<'Z' || y<'z'){
// printf("Please Enter only Numeric value");
// }
// END
//Conditional Operator
//int a=51;
//int x;
//x=(a>50)?printf("Done"):printf("not Done");
// while loop
//int s=1;
//while(s<=0){
// printf("It will not execute atleast for once if the condition is false\n");
// s++;
//}
//// do while loop
//
//int n=1;
//do{
// printf("do-while loop will execute atleast once if the condition is false\n");
// n++;
//}
//while(n<=0);
//
//printing star pattern
// int star, pattern;
// for(star=1; star<=5; star++){
// for (pattern=1; pattern<=star; pattern++){
// printf("*");
// } printf("\n");
//
// }
//Multiplication table
// int a,b;
// printf("Enter a number to see its table\n");
// scanf("%d", &a);
// for (b=1; b<=20; b++){
// printf("\t %d * %d = %d\n", a, b, a*b);
// }
// writing a program input three numbers from user and tell him which is largest number
// int a, b, c;
//
// printf("Enter number A\n");
// scanf("%d", &a);
//
// printf("Enter number B\n");
// scanf("%d", &b);
//
// printf("Enter number C\n");
// scanf("%d", &c);
//
// if (a>b && a>c) {
// printf ("A is largest number\n");
// }
// else if (b>a && b>c) {
// printf ("B is largest number\n");
// }
// else {
// printf("C is largest number");
//
// }
return 0;
}
// Code ScreenShot:
Comments
Post a Comment