C program for Macro Processor
#include<stdio.h>
#include<conio.h>
#define getx1y1
printf("Enter the order of Ist Matrix:");
scanf("%d%d",&x1,&y1);
#define getx2y2
printf("Enter the order of IIst Matrix:");
scanf("%d%d",&x2,&y2);
#define inputa
printf("Enter the value of a:");
for(i=0;i<x1;i++)
for(j=0;j<y1;j++)
scanf("%d",&a[i][j]);
#define inputb
printf("Enter the value of b:");
for(i=0;i<x2;i++)
for(j=0;j<y2;j++)
scanf("%d",&b[i][j]);
#define addab
for(i=0;i<x1;i++)
{
for(j=0;j<y1;j++)
{
c[i][j]=0;
for(k=0;k<x1;k++)
{
c[i][j]=c[i][j]+a[i][k]*b[k][j];
}
}
}
#define output
printf("n The Result is:");
for(i=0;i<x1;i++)
for(j=0;j<y1;j++)
printf("tn%d",c[i][j]);
void main()
{
int a[5][5],b[5][5],c[5][5],i,j,k,x1,x2,y1,y2;
clrscr();
getx1y1;
getx2y2;
if((x1==x2)&&(y1==y2))
{
inputa;
inputb;
addab;
output;
}
else
printf("Matrix Addition Not Possible");
getch();
} |
#include<stdio.h>
#include<conio.h>
#define getx1y1
printf("Enter the order of Ist Matrix:");
scanf("%d%d",&x1,&y1);
#define getx2y2
printf("Enter the order of IIst Matrix:");
scanf("%d%d",&x2,&y2);
#define inputa
printf("Enter the value of a:");
for(i=0;i<x1;i++)
for(j=0;j<y1;j++)
scanf("%d",&a[i][j]);
#define inputb
printf("Enter the value of b:");
for(i=0;i<x2;i++)
for(j=0;j<y2;j++)
scanf("%d",&b[i][j]);
#define addab
for(i=0;i<x1;i++)
{
for(j=0;j<y1;j++)
{
c[i][j]=0;
for(k=0;k<x1;k++)
{
c[i][j]=c[i][j]+a[i][k]*b[k][j];
}
}
}
#define output
printf("n The Result is:");
for(i=0;i<x1;i++)
for(j=0;j<y1;j++)
printf("tn%d",c[i][j]);
void main()
{
int a[5][5],b[5][5],c[5][5],i,j,k,x1,x2,y1,y2;
clrscr();
getx1y1;
getx2y2;
if((x1==x2)&&(y1==y2))
{
inputa;
inputb;
addab;
output;
}
else
printf("Matrix Addition Not Possible");
getch();
}
Editorial Team
We are a group of young techies trying to provide the best study material for all Electronic and Computer science students. We are publishing Microcontroller projects, Basic Electronics, Digital Electronics, Computer projects and also c/c++, java programs.
is it sure with output????
Yen MAccha? What this progrem? you’re telling macro and putting matrix. What you’re thought of yoursalf?
Do you understand the meaning of “MACRO PROCESSOR”…???!!!!! You are a complete and utter motherfu**er. Go take a 1000 penises up your ass.