Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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 Help Members By Posting Answers For Below Questions

What are the usage of pointer in c?

1242


A global variable when referred to in another file is declared as this a) local variable b) external variable c) constant d) pointers

1278


What are global variables?

1264


How would you rename a function in C?

1086


What does a pointer variable always consist of?

1157


Why main is used in c?

1126


Explain the concept and use of type void.

1165


Why enum is used in c?

1015


Explain what is the difference between a string copy (strcpy) and a memory copy (memcpy)? When should each be used?

1146


Explain what are multidimensional arrays?

1122


Why can't I perform arithmetic on a void* pointer?

1156


What is the heap in c?

1123


Explain how can I open a file so that other programs can update it at the same time?

1175


What are directives in c?

1022


Explain the difference between call by value and call by reference in c language?

1159