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

The __________ attribute is used to announce variables based on definitions of columns in a table?

1214


Define and explain about ! Operator?

1002


Why c is faster than c++?

1043


What is wrong with this declaration?

1109


How can I determine whether a machines byte order is big-endian or little-endian?

1065


What are shell structures used for?

1054


Explain the difference between the local variable and global variable in c?

1075


What is time complexity c?

1000


What is character set?

1172


How do I round numbers?

1012


What type is sizeof?

1039


Write a program to display all the prime nos from 1 to 1000000, your code should not take time more than a minute to display all the nos.

2079


Explain how can I make sure that my program is the only one accessing a file?

1225


Explain the Difference between the New and Malloc keyword.

1141


Explain the difference between getch() and getche() in c?

1000