Tuesday, July 2, 2013

C PROGRAM FOR 2D MATRIX MULTIPLICATION

/*PROGRAM TO MULTIPLY TWO MATRICES*/

#include<stdio.h>
#include<conio.h>
void main() {
int i,j,k,m,n,o,p,sum=0;
int a[10][10],b[10][10],c[10][10];
clrscr();
printf("Enter order of 1st 2D matrix:");
scanf("%d %d",&m,&n);
printf("Enter order of 2nd 2D matrix");
scanf("%d %d",&o,&p);
if(n==o){
printf("Enter elements of 1st 2d matrix:");
for(i=1;i<=m;i++)
for(j=1;j<=n;j++){
                  printf("\na[%d][%d]=", i,j);
                  scanf("%d", &a[i][j]);
                  }
printf("Enter elements of 2nd 2D matrix:");
for(i=1;i<=o;i++)
for(j=1;j<=p;j++){
                  printf("\nb[%d][%d]=", i,j);
                  scanf("%d", &b[i][j]);
                  }
printf("\nThe product of two matrices has these elements:");
for(i=1;i<=m;i++)
for(j=1;j<=p;j++){
                  for(k=1;k<=n;k++)
                  sum=sum+a[i][k]*b[k][j];
                  c[i][j]=sum;
                  sum=0;
                  printf("\nc[%d][%d]=%d", i,j,c[i][j]);
                  }                
}
else
printf("The matrices cannot be multiplied");
getch();
}

/* OUTPUT:-
Enter order of 1st 2D matrix:1
2
Enter order of 2nd 2D matrix2
3
Enter elements of 1st 2d matrix:
a[1][1]=1

a[1][2]=2
Enter elements of 2nd 2D matrix:
b[1][1]=3

b[1][2]=4

b[1][3]=5

b[2][1]=6

b[2][2]=7

b[2][3]=8

The product of two matrices has these elements:
c[1][1]=15
c[1][2]=18
c[1][3]=21  */

C PROGRAM FOR 2D MATRIX ADDITION

/* PROGRAM TO ADD TWO MATRICES*/

#include<stdio.h>
#include<conio.h>
void main() {
int i,j,m,n;
int a[5][5],b[5][5],c[10][10];
clrscr();
printf("Enter size of 2D arrays:");
scanf("%d %d",&m,&n);
printf("Enter elements of 1st 2d matrix:");
for(i=1;i<=m;i++)
for(j=1;j<=n;j++){
                  printf("\na[%d][%d]=", i,j);
                  scanf("%d", &a[i][j]);
                  }
printf("Enter elements of 2nd 2D matrix:");
for(i=1;i<=m;i++)
for(j=1;j<=n;j++){
                  printf("\nb[%d][%d]=", i,j);
                  scanf("%d", &b[i][j]);
                  }
printf("\nThe sum of two matrix has these elements:");
for(i=1;i<=m;i++)
for(j=1;j<=n;j++){
                  c[i][j]=a[i][j]+b[i][j];
                  printf("\nc[%d][%d]=%d", i,j,c[i][j]);
                  }                
getch();
}

/* OUTPUT:-
Enter size of 2D arrays:1
2
Enter elements of 1st 2d matrix:
a[1][1]=1

a[1][2]=2
Enter elements of 2nd 2D matrix:
b[1][1]=1

b[1][2]=5

The sum of two matrix has these elements:
c[1][1]=2
c[1][2]=7  */

Monday, December 26, 2011

BEST GOOGLE FUN SITES

BEST GOOGLE FUN TOOLS
1:- GOOGLE SPHERE :- Its web link is : GOOGLE SPHERE.

2:- GOOGLE GRAVITY :- Its web link is : GOOGLE GRAVITY.

3:- GOOGLE DOODLE :- As it is the most common to see, it can be found in Google homepage. But my favorite google doodle is : Les Paul's 96th Birthday Google Doodle.

4:- GOOGLE REVERSE :- It is the mirror image of Google homepage. Its link is : elgooG.

5:- GOOGLE X :- It has very nice look. Its link is : GOOGLE X.

6:- LET ME GOOGLE THAT FOR YOU :- Its link is :  Let me google that for you.

7:- WHAT DO YOU LOVE? :- Its link is : What do you love?.


OTHERS
1:- GOOGLE URL SHORTENER :- It is for tech purpose. Its link is: Google URL Shortener.