Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Data

Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

P R E S E N T A T I O N T O P I C S :

W R I T E A P R O G R A M I N C T O T A K E T H E
M A T R I X ’ S S I Z E A S I N P U T F R O M T H E
K E Y B O A R D A N D D O T H E F O L L O W I N G .

T A S K 1 : A D D I T I O N O F 2 M A T R I X E S .
T A S K 2 . S U B T R A C T I O N O F 2 M A T R I X E S .
T A S K 3 . M U L T I P L I C A T I O N O F 2 M A T R I X E S .

Prepared By, Md Emon Shahariar Syum


ID :- 221014009
ALGORITHM :
step-1 : start
step-2: do{
options for choice
1. Addition\n");
2. Subtraction\n");
3. Multiplication\n");
4.Exit
step-3 : take input for row and column
step-4 : take elements of matrixes
step-5 : switch(choice)
{
case 1: perform addition and print result
case 1: perform subtraction and print result
case 1:perform multiplication and print result

step-6 : End
#include<stdio.h> switch(choice)

{
COde int r,c,i,j,num1[10][10],num2[10][10],res[10][10]; case 1:for(i=0;i<r;i++)
int main() for(j=0;j<c;j++){
{ res[i][j] = num1[i][j]+num2[i][j];

printf("\t %d\n", res[i][j]);}
int choice; break;
do case 2:
{ res[i][j]=num1[i][j]-num2[i][j];
printf("1. Addition\n"); printf("\t %d\n", res[i][j]);
printf("2. Subtraction\n"); break;
printf("3. Multiplication\n"); case 3:
printf("4.Exit\n\n"); res[i][j] = num1[i][j]*num2[i][j];
printf("Enter Your Choice(1-4): "); printf("\t %d\n", res[i][j]);
scanf("%d", &choice); break;

printf("\nEnter row & column : "); case 4:


scanf("%d %d", &r, &c); return 0;
printf("\nEnter 1st matrix : "); default:

printf("\nWrong Choice!");
for(i=0;i<r;i++) break;
for(j=0;j<c;j++) }
scanf("%d",&num1[i][j]); printf("\n------------------------\n");
printf("\nEnter 2nd matrix : "); }while(choice!=5);
for(i=0;i<r;i++)

for(j=0;j<c;j++) return 0;
scanf("%d",&num2[i][j]); }
OUTPUT:
Thank
you!!

You might also like