#include <stdio.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
void app_main(){
uint8_t a,b,c,y;
a = 200;
b = 56;
c = 16;
y = 0;
y = ~a;
printf(" The one's complement (NOT) of 200 is %i \n", y);
y = a & b;
printf(" Bitwise ANDING of 200 and 56 gives %i \n", y);
y = a | b;
printf(" Bitwise ORING of 200 and 56 gives %i \n", y);
y = a ^ b;
printf(" Bitwise XORING of 200 and 56 gives %i \n", y);
y = b << 4;
printf(" Bitwise left shift by 4 of the value 56: %i\n", y); //Ex1 - Q1 (JI)
y = a << 3;
printf(" Bitwise left shift by 3 of the value 200 gives %i \n", y);
y = a >> 3;
printf(" Bitwise right shift by 3 of the value 200 gives %i \n", y);
y = b >> 5;
printf(" Bitwise right shift by 5 of the value 56: %i\n", y); //Ex1 - Q2 (JI)
y = b ^ c;
printf(" Bitwise XORING of 56 and 16: %i\n", y); //Ex1 - Q3 (JI)
printf(" Multiplying the value 16 by 8 (2^3) gives %i. Bit shifting the value 16 by 3 bits to the left also gives %i \n", c*8, c<<3);
printf(" Dividing the value 16 by 8 (2^3) gives %i. Bit shifting the value 16 by 3 bits to the right also gives %i \n", c/8, c>>3);
}
Loading
esp32-s3-devkitc-1
esp32-s3-devkitc-1