/*WAP to illustrate the equal to and not equal to operator with if else*/ #include<stdio.h> #include<conio.h> void main() { int x,y; clrscr(); printf("enter the value of x & y:\n"); scanf("%d %d",&x,&y); if(x==0&&y==0) { printf("the point is origin"); } else if(x==0&&y!=0) { printf("the point is on y-axis"); } else if(y==0&&x!=0) { printf("the point is on x-axis"); } else printf("the point is not on any axis"); getch(); }
Showing posts with label Operators. Show all posts
Showing posts with label Operators. Show all posts
WAP to illustrate the equal to and not equal to operator with if else
WAP that illustrate the increament operator
#include <stdio.h> main() { int value = 1; while(value<=3) { printf("Value is %d\n", value); value++; } return 0; }
Wap to illustratr IF ELSE using Relational Operator
#include<stdio.h> #include<conio.h> void main() { int a=10,b=5; clrscr(); if(a>b) { if(b>5) printf("%d",b); } else printf("%d",a); getch(); }
Wap to illustrate the use of IF ELSE using Equal to Operator
#include<stdio.h> #include<conio.h> void main() { int m=1; clrscr(); if(m==1) { printf("delhi"); if(m==2) printf("chennai"); else printf("banglore"); } else; printf("end"); getch(); }
Wap to illustrtate the EQUAL TO operator
#include <stdio.h> main() { int x = 1; if ( x == 1 ) printf("x is equal to one.\n"); else printf("For comparison use == as = is the assignment operator.\n"); return 0; }
Subscribe to:
Posts (Atom)