Posts

Showing posts from November, 2024

Crc

 #include <stdio.h>  #include <string.h>    void xor(char *a, char *b, int len) {      int i;      for (i = 0; i < len; i++) {          b[i] = (b[i] == a[i]) ? '0' : '1';      }  }    int main() {      char a[10], b[100], remainder[100];      int m, n;        printf("\nEnter the polynomial: ");      scanf("%s", a);        printf("\nEnter the frame: ");      scanf("%s", b);        m = strlen(a);      n = strlen(b);        // Ensure the polynomial has no leading zeros      while (a[0] == '0' && m > 1) {          for (int i = 0; i < m - 1; i++) {              a[i] = a[i + 1];          }      ...