Example of == and !=
#include<stdio.h> int main() { int a=10,b=20,c; c=a==b; printf("a = %d\n",a); printf("b = %d\n",b); printf("%d == %d = %d\n",a,b,c); return 0; }
/* Output */ a = 10 b = 20 10 == 20 = 0
#include<stdio.h> int main() { int a=10,b=20,c; c=a!=b; printf("a = %d\n",a); printf("b = %d\n",b); printf("%d != %d = %d\n",a,b,c); return 0; }
/* Output */ a = 10 b = 20 10 != 20 = 1
Solve the following:
1.
#include<stdio.h> int main() { int a,b,c; /* 1 */ a=10; b=20; c=a=b; printf("c = %d\n",c); /* 2 */ a=10; b=20; c=b=a; printf("c = %d\n",c); return 0; }
/* Output */ c = 20 c = 10