XOR Gate for multiple Inputs

XOR Gate for multiple Inputs:

//XOR gate for multiple inputs
#include<iostream>
using namespace std;
int xor(int a[5]);
void main()
{
int a[5];
cout<<"Enter 5 inputs (0,1)"<<endl;
for(int i=0;i<5;i++)
{
cin>>a[i];
}
cout<<"output : "<<xor(a)<<endl;
}
int xor(int a[5])
{
int count=0;
for(int i=0;i<5;i++)
{
if(a[i]==1)
count++;
}
if(count%2==1)
return 1;
else 
return 0;
}

Download:

To download this code click on the given link below:

Comments

Popular posts from this blog

How to Run Assembly Language Programming Code In Visual Studio 2019

How to Display Table of any Number in Assembly Language

How to Display Character in Assembly language