# Generation of Equivalent Binary Code of Decimal Digits

This is C source code, written in gcc platform (Ubuntu, 14.04 LTS, Linux).

Here is the process for generating the Equivalent Binary Code of a decimal digit. First, a palindrome number is being generated. If we Push n elements in the stack, it generates a palindrome number of length (2^n) -1.

This is the special property. Then it can generate Binary code of maximum n bit. Note that, we have to Push elements sequentially in Decreasing order. e.g 4,3,2,1. It generates 121312141213121, so now it can generate Binary code of maximum 4 bit.

``````/*   This is a Process of generating Palindrome number from some given numbers.      This is a Process of generating binary code from some given numbers.      It actually takes the help of palindrome generation.*/#include #define max 10#define maxim 300#define maxr 550#define maxc 9int pushA (int[], int*, int*);int cpyAC (int[], int[], int*);int palgen (int[], int[], int[], int*, int*);void display (int[], int*);void displayA (int[], int*);int binarycode (int A[maxr][maxc], int*, int*, int[], int*);void grycddisp (int A[maxr][maxc], int*, int*);//----------------------------------------------------int pushA (int a[max], int *top, int *item){    printf("
Enter element: ");    scanf("%d", &(*item));    a[++(*top)] = (*item);    printf("
Push is successful...
");    return (*top);}//----------------------------------------------------int cpyAC (int a[max], int c[max], int *top){  int i= -1, j= -1, toc;  while (j      c[++i] = a[++j];  toc= i;        return (toc);}//----------------------------------------------------int palgen (int a[max], int b[maxim], int c[max], int *top, int *toc){  int i, j, k, tob, x;  j= -1;  i= (*top);           k= (*toc);           while (k  -1)  {    b[++j] = c[k];    (*toc)--;    k= (*toc);    while (b[j] != a[i])    {      i--;    }    while (i      {      c[++k] = a[++i];      (*toc)++;          i+= 0;    }    (*toc)--;    k = (*toc);    k+= 0;     }  tob= j;           return (tob);  }//---------------------------------------------------int binarycode (int A[maxr][maxc], int *row, int *col, int b[maxim], int *tob){printf("

Row= %d, Col= %d

", *row, *col);               //create co-ordinate  int i=0, j, value, k;  while (i    {    j=(*col);    while (j 0 )    {      j--;    }    i++;  }               //binarycode generation  i= 0;  j= (*col);  while (j  0)  {    A[i][j] = 0;      j--;  }  while (i   {    i++;     j=(*col);    while (j0)    {      A[i][j] = A[i-1][j];      j--;    }    k= (*tob);    value = b[k];    (*tob)--;    j= value;    for(; j0; j--)    {          if (A[i][j] == 0)        A[i][j] = 1;      else        A[i][j] = 0;    }    i+=0;  }}//------------------------------------------------------------void grycddisp (int A[maxr][maxc], int *row, int *col){  int i= 0, j;  while (i    {    j=(*col);    while (j 0 )    {      printf("		%d", A[i][j]);      j--;    }    printf("
");    i++;  }}//------------------------------------------------------------void displayA (int a[max], int *top){  int i;  printf("
You entered...
");  i= (*top);  while (i = 0)  {    printf("
%d", a[i--]);  }}//---------------------------------------------------void display (int b[maxim], int *tob){  int i;  printf("
The items of Stack are shown...{B}
");  i= (*tob);  printf("

");  while (i = 0)  {    printf("%d", b[i--]);  }}//----------------------------------------------------void main (void){  int a[max], b[maxim], c[max], item=0, top =(-1), toc, tob;  int A[maxr][maxc], row =1, col =0, bit =0;  char ch;  system ("clear");  printf ("
This is a Process of generating binary Code of n-bit.
Please insert n numbers in decreasing order.
e.g 4,3,2,1 for 4-bit binary code.

");  if (top == -1)    printf("
Initially Stack is empty...
");    printf("
You have to give data, please start insertion.
Press 'y' for insert, 'n' for exit.

");  ch= getchar();  while (ch == 'y')   {    top= pushA (a, &top, &item);    printf("
'y' :insert
'n' :exit.
");    getchar();        ch= getchar();    getchar();    if( top == (max-1) )    {      printf("
Sorry...
Stack is full.
Push operation is not possible...

");      break;    }  }  system("clear");  displayA (a, &top);  if(top == -1)    printf("
Sorry...
Stack is empty...
Copy is done...

");  else   toc= cpyAC (a, c, &top);           tob= palgen (a, b, c, &top, &toc);        if(tob == -1)    printf("
Sorry...
Stack is empty...

");  else    display (b, &tob);//-------------------------------------------------------  printf("
Enter the bit number of binary code: ");  scanf("%d", &bit);  col= bit;  while (bit  0)  {    row= (row*2);    bit --;  }    binarycode (A, &row, &col, b, &tob);  grycddisp (A, &row, &col);  printf ("

T  H  A  N  K    Y  O  U

");  }``````

Share the Post:

### The iPhone 15’s Secrets and Surprises

As we dive into the most frequently asked questions and intriguing features, let us reiterate that the iPhone 15 brings substantial advancements in technology and

### iPhone 15 Pro Max: Overcoming Chip Setbacks

Apple recently faced a significant challenge in the development of a key component for its latest iPhone series, the iPhone 15 Pro Max, which was

### iPhone 15: Performance, Camera, Battery

Apple’s highly anticipated iPhone 15 has finally hit the market, sending ripples of excitement across the tech industry. For those considering upgrading to this new

### Electric Vehicle Battery Breakthrough

The prices of lithium-ion batteries have seen a considerable reduction, with the cost per kilowatt-hour dipping under \$100 for the first occasion in two years,

### Virginia’s Clean Economy Act Soars Ahead

Virginia has made significant strides towards achieving its short-term carbon-free objectives as outlined in the Clean Economy Act of 2020. Currently, about 44,000 megawatts (MW)

### Innovative Energy Storage Solutions

The Department of Energy recently revealed a significant investment of \$325 million in advanced battery technologies to store excess renewable energy produced by solar and

### The iPhone 15’s Secrets and Surprises

As we dive into the most frequently asked questions and intriguing features, let us reiterate that the iPhone 15 brings substantial advancements in technology and design compared to its predecessors.

### iPhone 15 Pro Max: Overcoming Chip Setbacks

Apple recently faced a significant challenge in the development of a key component for its latest iPhone series, the iPhone 15 Pro Max, which was unveiled just a week ago.

### iPhone 15: Performance, Camera, Battery

Apple’s highly anticipated iPhone 15 has finally hit the market, sending ripples of excitement across the tech industry. For those considering upgrading to this new model, three essential features come

### Electric Vehicle Battery Breakthrough

The prices of lithium-ion batteries have seen a considerable reduction, with the cost per kilowatt-hour dipping under \$100 for the first occasion in two years, as reported by energy analytics

### Virginia’s Clean Economy Act Soars Ahead

Virginia has made significant strides towards achieving its short-term carbon-free objectives as outlined in the Clean Economy Act of 2020. Currently, about 44,000 megawatts (MW) of wind, solar, and energy

### Innovative Energy Storage Solutions

The Department of Energy recently revealed a significant investment of \$325 million in advanced battery technologies to store excess renewable energy produced by solar and wind sources. This funding will

### Revolutionizing India’s Tech Sector with Renesas

Tushar Sharma, a semiconductor engineer at Renesas Electronics, met with Indian Prime Minister Narendra Modi to discuss the company’s support for India’s “Make in India” initiative. This initiative focuses on

### Thrilling East Windsor Mixed-Use Development

Real estate developer James Cormier, in collaboration with a partnership, has purchased 137 acres of land in Connecticut for \$1.15 million with the intention of constructing residential and commercial buildings.

### Top Software Development Companies in USA

Navigating the tech landscape to find the right partner is crucial yet challenging. This article offers a comparative glimpse into the top software development companies in the USA. Through a

### Top Software Development Companies

Looking for the best in software development? Our list of Top Software Development Companies is your gateway to finding the right tech partner. Dive in and explore the leaders in

### Top Web Development Companies in India

In the digital race, the right web development partner is your winning edge. Dive into our curated list of top web development companies in India, and kickstart your journey to

### Top Web Development Companies in USA

Looking for the best web development companies in the USA? We’ve got you covered! Check out our top 10 picks to find the right partner for your online project. Your

### Inside Michigan’s Clean Energy Revolution

Democratic state legislators in Michigan continue to discuss and debate clean energy legislation in the hopes of establishing a comprehensive clean energy strategy for the state. A Senate committee meeting

### European Chips Act: What is it?

In response to the intensifying worldwide technology competition, Europe has unveiled the long-awaited European Chips Act. This daring legislative proposal aims to fortify Europe’s semiconductor supply chain and enhance its

### You Should Use Low-Code Platforms for Apps

As the demand for rapid software development increases, low-code platforms have emerged as a popular choice among developers for their ability to build applications with minimal coding. These platforms not

### Five Powerful Strategies to Bolster Your Cybersecurity

In today’s increasingly digital landscape, businesses of all sizes must prioritize cyber security measures to defend against potential dangers. Cyber security professionals suggest five simple technological strategies to help companies

### Tech Layoffs Are Getting Worse Globally

Since the start of 2023, the global technology sector has experienced a significant rise in layoffs, with over 236,000 workers being let go by 1,019 tech firms, as per data

### Huawei Dazzles with Electric Vehicles and Wireless Earbuds

During a prominent unveiling event, Huawei, the Chinese telecommunications powerhouse, kept quiet about its enigmatic new 5G phone and alleged cutting-edge chip development. Instead, Huawei astounded the audience by presenting

### Digital Banking Needs Cybersecurity

The banking, financial, and insurance (BFSI) sectors are pioneers in digital transformation, using web applications and application programming interfaces (APIs) to provide seamless services to customers around the world. Rising

### Terry Clune’s Fintech Empire

Over the past 30 years, Terry Clune has built a remarkable business empire, with CluneTech at the helm. The CEO and Founder has successfully created eight fintech firms, attracting renowned

### The Role Of AI Within A Web Design Agency?

In the digital age, the role of Artificial Intelligence (AI) in web design is rapidly evolving, transitioning from a futuristic concept to practical tools used in design, coding, content writing

### The Future of AI and the Investment Opportunities it Presents

There is no doubt that modern technology has changed the way we live and work forever. Nowadays, there is a wide array of different types of technologies such as AI

### Is Generative AI the Next Internet?

The increasing demand for Generative AI models has led to a surge in its adoption across diverse sectors, with healthcare, automotive, and financial services being among the top beneficiaries. These

### The New Surface Laptop Studio 2 Is Nuts

The Surface Laptop Studio 2 is a dynamic and robust all-in-one laptop designed for creators and professionals alike. It features a 14.4″ touchscreen and a cutting-edge design that is over

### GPU-Accelerated 5G in Japan

NTT DOCOMO, a global telecommunications giant, is set to break new ground in the industry as it prepares to launch a GPU-accelerated 5G network in Japan. This innovative approach will