write an algorithm and c program to add two 2x2 matrics
Answer Posted / gouthami chintala
#include<stdio.h>
#include<conio.h>
void main()
{
int a[2][2],b[2][2],c[2][2];
int i,j;
printf("enter the elements for first matrix");
for(i=0;i<=1;i++)
{
for(j=0;j<=1;j++)
{
scanf("%d",&a[i][j]);
}
}printf("enter the elements for second matrix");
for(i=0;i<=1;i++)
{
for(j=0;j<=1;j++)
{
scanf("%d",&b[i][j]);
}
}
for(i=0;i<=1;i++)
{
for(j=0;j<=1;j++)
{
c[i][j]=a[i][j]+b[i][j];
}
}
printf("the added matrix is ");
for(i=0;i<=1;i++)
{
for(j=0;j<=1;j++)
{
printf("%d",c[i][j]);
}
}
}
Is This Answer Correct ? | 24 Yes | 22 No |
Post New Answer View All Answers
please can any one suggest me best useful video tutorials on c i am science graduate.please help me.u can email me to sas29@in.com
Which is better malloc or calloc?
using for loop sum 2 number of any 4 digit number in c language
What is the explanation for cyclic nature of data types in c?
Explain how are 16- and 32-bit numbers stored?
Write a program with dynamically allocation of variable.
In C programming, how do you insert quote characters (‘ and “) into the output screen?
Explain what are header files and explain what are its uses in c programming?
What is volatile keyword in c?
How can I get random integers in a certain range?
Is c procedural or functional?
Can you write a programmer for FACTORIAL using recursion?
Explain what are bus errors, memory faults, and core dumps?
Write a code on reverse string and its complexity.
What is the right type to use for boolean values in c? Is there a standard type?