## BoolGorithm – 1 (hey guys i have started a project on Solving a boolean equation provided the minterms by the user to get a simplified equation using C , flow in and contribute to the code )

/*Project BoolGOrithm, this part of the code tells u the no.of.ones in the supplied minterms */
/*21/9/2011*/
//FRom 22-00//
#include<stdio.h>
#include<stdlib.h>
int main()
{
int n,size,i,j,k,f,num,arrsize;

printf("\nEnter the no.of.Input variables: ");
scanf("%d",&n);
printf("\nEnter no.of.Minterms Available: ");
scanf("%d",&size);
arrsize=(1<<n)-1;
if(size>arrsize)
{
printf("\nInvalid Input");
exit(EXIT_FAILURE);
}
int minterms[arrsize];
printf("\nEnter the Min terms: ");
for(i=0;i<size;i++)
{
scanf("%d",&minterms[i]);
if(minterms[i]>arrsize)
{
printf("\nInvalid Input");
exit(EXIT_FAILURE);
}
}
for(j=0;j<size;j++)
{
num=0;
for(i=n-1;i>=0;i--)
{
k=(minterms[j]& (1<<i));
if(k)
num++;

}
printf("\n\nThe minterm is %d,    no.of.ones is %d ",minterms[j],num);
}
return 0;
}
//23-50 110 Minutes of coding