#include <stdio.h>
int main() {
int result; // Declare the 'result' variable
// Addition
result = 5 + 3;
printf("Addition: %d\n", result); // Add format specifier %d
// Subtraction
result = 8 - 2;
printf("Subtraction: %d\n", result);
// Multiplication
result = 4 * 6;
printf("Multiplication: %d\n", result);
// Division
result = 10 / 2;
printf("Division: %d\n", result);
return 0;
}
#include <stdio.h>
int main() {
int x = 5;
// Increment
x += 1; // This is equivalent to x = x + 1
printf("Increment: %d\n", x);
int y = 8;
// Decrement
y -= 1; // This is equivalent to y = y - 1
printf("Decrement: %d\n", y);
return 0;
}
#include <stdio.h>
int main() {
// Greater than
int result = 5 > 3;
printf("Greater than: %d\n", result);
// Less than
result = 4 < 2;
printf("Less than: %d\n", result);
// Equal to
result = 10 == 10;
printf("Equal to: %d\n", result);
// Not equal to
result = 7 != 7;
printf("Not equal to: %d\n", result);
return 0;
}
#include <stdio.h>
int main() {
_Bool result;
// AND operator
result = 1 && 0;
printf("AND: %d\n", result);
// OR operator
result = 1 || 0;
printf("OR: %d\n", result);
// NOT operator
result = !1;
printf("NOT: %d\n", result);
return 0;
}
#include <stdio.h>
int main() {
int x = 10; // Variable assignment
printf("Assignment: %d\n", x); // Printing the value of x
return 0;
}
#include <stdio.h>
int main() {
int x = 5;
// Shorthand Addition
x += 3; // Equivalent to x = x + 3
printf("Shorthand Addition: %d\n", x);
int y = 4;
// Shorthand Multiplication
y *= 2; // Equivalent to y = y * 2
printf("Shorthand Multiplication: %d\n", y);
return 0;
}
#include <stdio.h>
int main() {
int x = 7;
int y = 5;
int result = (x > y) ? x : y; // Conditional Operator
printf("Conditional Operator: %d\n", result);
return 0;
}
#include <stdio.h>
int main() {
int result;
// Bitwise AND
result = 5 & 3;
printf("Bitwise AND: %d\n", result);
// Bitwise OR
result = 5 | 3;
printf("Bitwise OR: %d\n", result);
return 0;
}
#include <stdio.h>
int main() {
int x, y, z;
// Comma Operator
x = (5, 3, 8);
printf("Comma Operator: %d\n", z);
return 0;
}