C Programme For Array
C Programme For Array
#include<stdio.h>
#include<conio.h>
#include<process.h>
void main()
{
int mat1[3][3],mat2[3][3], mat3[3][3];
int choice,a,b;
int i,j,k;
clrscr();
printf("Press 1 for Addition two Numbers\n");
printf("Press 2 for Subtraction two Numbers\n");
printf("Press 3 for Multiplication two numbers\n");
printf("Press 4 for Division two numbers\n");
printf("Press 5 for Remainder two numbers\n");
printf("Press 6 for Matrix Addition\n");
printf("Press 7 for Matrix Subtraction\n");
printf("Press 8 for Matrix MUltiplication\n");
printf("Press 9 for EXIT");
printf("\nEnter Your Choice\n\n");
scanf("%d",&choice);
switch(choice)
{
case 1:
printf("Enter Two Numbers for Addition\n");
scanf("%d%d",&a,&b);
printf("The Addition of two Numbers = %d",(a+b));
break;
case 2:
printf("Enter Two Numbers for Subtraction\n");
scanf("%d%d",&a,&b);
printf("The Subtraction of two Numbers = %d",(a-b));
break;
case 3:
printf("Enter Two Numbers for Multiplication\n");
scanf("%d%d",&a,&b);
printf("The Multiplication of two Numbers = %d",(a*b));
break;
case 4:
printf("Enter Two Numbers for Division\n");
scanf("%d%d",&a,&b);
printf("The Division of two Numbers = %d",(a/b));
break;
case 5:
printf("Enter Two Numbers for Remainder\n");
scanf("%d%d",&a,&b);
printf("The Remainder of two Numbers = %d",(a%b));
break;
case 6:
{
scanf("%d",&mat1[i][j]);
}
}
printf("Your first Matrix is as follows\n");
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
printf("%d\t",mat1[i][j]);
}
printf("\n\n");
}
printf("Enter Elements of the SEcond Matrix\n");
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
scanf("%d",&mat2[i][j]);
}
}
printf("Your Second Matrix is as follows\n");
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
printf("%d\t",mat2[i][j]);
}
printf("\n\n");
}
printf("Matrix Subtraction is as follows:\n");
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
mat3[i][j] = mat1[i][j] - mat2[i][j];
}
}
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
printf("%d\t",mat3[i][j]);
}
printf("\n\n");
}
break;
case 8:
printf("\nEnter Elements of the first Matrix\n");
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
scanf("%d",&mat1[i][j]);
}
}
RESULT