Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
1.7 kB
3
Indexable
Never
#include<stdio.h>
int main(){
	int a,b;
	printf("ENETR YOUR FIRST NUMBER: ");
	scanf("%d",&a);
	printf("ENETR YOUR SECOND NUMBER: ");
	scanf("%d",&b);
	
	// Arithmatic Operation
	printf("\nSum of these number is: %d", a+b);
	printf("\nSubstraction of these number is: %d", a-b);
	printf("\nMultiplication of these number is: %d", a*b);
	printf("\nDivision of these number is: %d", a/b);
	printf("\nModulus of these number is: %d\n", a%b);
					
   	// Shift Operators
	printf("\nShift Operators:\n");		
	printf("\n a<<1 = %d",a>>1);
    printf("\n a>>1 = %d\n",a<<1);
			
    // Relational Operators
    printf("\nRelational Operators:\n");
    printf("a > b: %d\n", a > b);
    printf("a < b: %d\n", a < b);
    printf("a >= b: %d\n", a >= b);
    printf("a <= b: %d\n", a <= b);
    
     // Equality Operators
    printf("\nEquality Operators:\n");
    printf("a == b: %d\n", a == b);
    printf("a != b: %d\n", a != b);
    
    // Bitwise Operators
    printf("\nBitwise Operators:\n");
    printf("a & b: %d\n", a & b);  // Bitwise AND
    printf("a ^ b: %d\n", a ^ b);  // Bitwise XOR
    printf("a | b: %d\n", a | b);  // Bitwise OR
    
    // Logical Operators
    printf("\nLogical Operators:\n");
    printf("a && b: %d\n", a && b); // Logical AND
    printf("a || b: %d\n", a || b); // Logical OR
    
    // Conditional Operator
    printf("\nConditional Operator:\n");
    int max = (a > b) ? a : b; // max = a if a > b, otherwise max = b
    printf("\nmax(a, b): %d\n", max);
    
    // Assignment Operator
    int c;
    c = a;  // Assignment
    printf("\nAssignment Operator:\n");
    printf("c = a: %d\n", c);
    
   return 0;
}
Leave a Comment