Walsh Matrix fixed power

Ram Pothuraju
This program is for implementing WALSH MATRIX .


#include<stdio.h>
#include<conio.h>
void main()
{
int choice, *arr, i, order, size;
char ans;
do
{
clrscr();
printf("List of operations:\n");
printf("\n1. Walsh Matrix of order 1");
printf("\n2. Walsh Matrix of order 2");
printf("\n3. Walsh Matrix of order 4");
printf("\n0.Exit ");
printf("\n\nEnter your choice: ");
scanf("%d",&choice);
switch(choice)
{
case 1:
order = 1;
size = order*order;
arr[0] = 1;
arr[size]='\0';
break;
case 2:
order = 2;
size = order*order;
for(i=0;i<size;i++)
arr[i] = 1;
arr[3] = -1;
break;
case 3:
order = 4;
size = order*order;
for(i=0;i<size;i++)
arr[i] = 1;
arr[5] = -1;
arr[7] = -1;
arr[10] = -1;
arr[11] = -1;
arr[13] = -1;
arr[14] = -1;
break;
case 0:
exit();
break;
default:
printf("\nINVALID OPTION..\n\n");
}
printf("\n\nWalsh Matrix of order %d :\n\n",choice);
for(i=0;i<size;i++)
{
if(i%order == 0)
printf("\n");
printf("%3d",arr[i]);
}
getch();
}while(1);
arr[size]=0;
getch();
}


Post a Comment

0Comments

Post a Comment (0)